0

I have a Video Recording feature of my app which successfully records and save in Documents directory in device ( Which i can access from iTunes when i plug device ). My problem is , I made View UI for playback video with APP which does not access or play.

Here is my video URL = /var/mobile/Applications/C13AB577-FFB2-4814-BD39-A9835A2DAE28/Documents/WO-00604-140428101904.349.mp4

My implementation code is :

mediaUrl = [mediaUrl URLByAppendingPathComponent:mediaName];

mediaPlayer.movieSourceType = MPMovieSourceTypeStreaming;

mediaPlayer = [[MPMoviePlayerController alloc] init];

mediaPlayer.controlStyle=MPMovieControlStyleDefault;

mediaPlayer.contentURL = mediaUrl;

mediaPlayer.shouldAutoplay = YES;

mediaPlayer.controlStyle=MPMediaTypeAnyVideo;

[mediaPlayer prepareToPlay];

[mediaPlayer.view setFrame: CGRectMake(0, 0, 360.0, 480.0)];

[self.view addSubview:mediaPlayer.view];

[mediaPlayer play];

mediaURL in debug has that value : http://prntscr.com/3e6ohi

Onder OZCAN
  • 1,556
  • 1
  • 16
  • 36

1 Answers1

0

I run successfully with current code, I think you should check your mediaURL:

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *basePath = ([paths count] > 0) ? [paths objectAtIndex:0] : nil;
basePath = [basePath stringByAppendingString:@"/MyVideo.mp4"];
NSURL *url = [NSURL fileURLWithPath:basePath];
mediaPlayer.contentURL = url;
nmh
  • 2,497
  • 1
  • 15
  • 27