Can not play local viedeo or mp3

Mustafa İsmail ALKAN's Avatar

Mustafa İsmail ALKAN

30 Nov, 2012 08:31 AM

I could not play local video or mp3. I tried to documentManager.resourceFolder = @"/Library"; or just documentManager.resourceFolder = @""; I put my video in that folder i recheck 4 times my link on pdf. But its not working.

  1. 1 Posted by Nicolò on 30 Nov, 2012 09:37 AM

    Nicolò's Avatar


    That @"Library" should be the absolute path of the Library folder, which for the simulator is more or less something like this
    @"/Users/yourusername/Library/Application Support/iPhone Simulator/Applications/2CB6064F-7623-4920-96C1-60305FAC2434/Library" (on the device is similar, but not the same). Supposing that you want to put a video.mp4 and a audio.mp3 files in the "Library" path and you have added them to your project (that is, in the bundle). The annotations url will be fpkv://video.mp4, etc (no intermediate folder since they will be placed directly into the resourceFolder directory)

    Utility method to get the library path.
    +(NSString *)libraryPath
    NSArray * paths = NSSearchPathForDirectoriesInDomains(
                        NSLibraryDirectory, NSUserDomainMask, YES); // Array of paths
    NSString *libraryPath = [paths objectAtIndex:0]; // The absolute path of the Library directory on both sim and device
    return libraryPath;
    Self explicative method name.
    NSFIleManager * fileManager = [NSFileManager defaultManager];
    // Check the video file (omitted error handling)
    NSString * fileToCheck = [MyClass libraryPath] stringByAppendingPathComponent:@"video.mp4"];
    if( ! [fileManager itemExistAtPath:fileToCheck isDirectory:NULL]) 
    // Copy the video.mp4 from the bundle to the fileToCheck path
    NSString * srcPath = [[NSBundle mainBundle]pathForResource:@"video.mp4" ofType:nil];
    [fileManager copyItemAtPath:srcPath toPath:fileToCheck error:NULL];
    /* Do the same for the other files */
    Method invoked to open the document.
    -(void)openDocument {
    MFDocumentManager * manager = ...
    manager.resourceFolder = [MyClass libraryPath];
    ReaderViewController * controller = ...
    [MyClass ensureMultimediaFilesAreWhereTheyShouldBe];
  2. 2 Posted by parkarfahim22 on 27 Feb, 2013 04:09 PM

    parkarfahim22's Avatar

    Hi Mustafa,

    Did you find a solution for this?

    I am also not able to play the video/ audio.

    Below is the link for my question. If you know answer, could you please post the answer.

  3. 3 Posted by mustafa on 27 Feb, 2013 04:20 PM

    mustafa's Avatar


    I solved it but Idont rememeber exactly. The point is you should place
    your mp4 or mp3 file into app bundle

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:


Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

Recent Discussions

26 Feb, 2020 07:23 AM
27 Jun, 2019 06:08 AM
23 Nov, 2018 01:54 PM
14 Nov, 2018 04:37 PM
26 Oct, 2018 07:17 PM