I am trying to play a video by MPMoviePlayerController in iOS 6.0 by two methods.
- Right after camera captures it and
- From Camera Roll
Here is the snippet for it.
-(void) playMovie
{
self.moviePlayer = [[MPMoviePlayerController alloc] init];
[self.moviePlayer prepareToPlay];
[self.moviePlayer setContentURL:self.movieURL];
self.moviePlayer.movieSourceType = MPMovieSourceTypeFile;
[self.moviePlayer.view setFrame:CGRectMake ( 0, 0, 320, 476)];
[self.view addSubview:self.moviePlayer.view];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moviePlayBackDidFinish:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:self.moviePlayer];
[self.moviePlayer play];
}
I tried taking the property moviePlayer
as both strong and retain but no use.
My problem is very much similar to this Question, that the video stops within one second. However if you are playing a video which is over internet it works fine.
Here is the Git Source Code for What I have tried