Hi i have created app for ipad , it has an video files in resource folder and it plays when the user click play button. It works for first time user clicks play button but when user plays subsequent times of video file.The issues occurs that is the video is not play only audio is playing.These issues occurs not randomly but some more times it will occurs.
One more thing at the time of issue occurs (Video is not playing ) , when i click the wo-arrow icons located at the bottom right corner of the player the movie goes to full screen and it shows video .At the time video is playing.
Can any one help me ?
Here is my sample code
MPMoviePlayerController *moviePlayer;
} @property (readwrite, retain) MPMoviePlayerController *moviePlayer; @synthesize moviePlayer;
- (void)viewDidLoad {
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(movieFinishedCallback:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:self.moviePlayer];
[super viewDidLoad];
}
-(IBAction)PlayBtnPressed:(id)sender
{
NSURL *movieURL;
NSString *moviePath = [[NSBundle mainBundle] pathForResource:@"title" ofType:@"mp4"];
movieURL = [NSURL fileURLWithPath:moviePath];
// Initialize a movie player object with the specified URL
MPMoviePlayerController *mp = [[MPMoviePlayerController alloc] initWithContentURL:movieURL];
if (mp)
{
// save the movie player object
self.moviePlayer = mp;
[mp release];
UIInterfaceOrientation orientation = [[UIDevice currentDevice]orientation];
[self shouldAutorotateToInterfaceOrientation:orientation];
// Play the movie!
[self.view addSubview:self.moviePlayer.view];
[self.moviePlayer play];
}
}
- (void) movieFinishedCallback:(NSNotification*) aNotification {
NSLog(@"movieFinishedCallback aNotification");
MPMoviePlayerController *player = [aNotification object];
[[NSNotificationCenter defaultCenter]
removeObserver:self
name:MPMoviePlayerPlaybackDidFinishNotification
object:player];
[player stop];
[player.view removeFromSuperview];
}
Thanks in advance ........