Log in or register to post comments

Video Playback from documents directory

October 18, 2012 - 4:52am #1

Hi,

I changed little code in

- (BOOL)load:(NSString*)filename playImmediately:(BOOL)playOnTextureImmediately fromPosition:(float)seekPosition

of VideoPlayerHelper class. I want it to play video from documents directory. Here is the code

 

NSString* fullPath;
            // Play media from this app's Resources folder
            if ([[NSFileManager defaultManager] fileExistsAtPath:filename]) {
                fullPath = filename;
            }
            else {
                NSString* resourcesFolder = [[NSBundle mainBundle] resourcePath];
                fullPath = [resourcesFolder stringByAppendingPathComponent:filename];               
            }

NSLog(@"Full Path: %@", fullPath);

            mediaURL = [[NSURL alloc] initFileURLWithPath:fullPath];

Media Url printed for bundle file is

file://localhost/var/mobile/Applications/8A0C355C-AE26-4035-8DF9-7243962D6B53/What%20The%20Buck.app/Chris6.m4v

Media Url printed for documents directory file is

file://localhost/var/mobile/Applications/8A0C355C-AE26-4035-8DF9-7243962D6B53/Documents/obam1.m4v

Bundle file is working fine where as documents directory video is not playing. What should i do?

 

Video Playback from documents directory

October 18, 2012 - 6:33am #2

Solved it by calling play method of Videohelper below load method

Log in or register to post comments