I am working on an iPhone application that uses a MediaPlayer to play a couple different videos. It works great for the first video but when I try to play another the screen stays black and only the audio plays. Does anyone have any idea why this might be happening?
Here is my code:
-(NSURL *)movieURL
{
NSBundle *bundle = [NSBundle mainBundle];
if (bundle)
{
NSString *moviePath = [bundle pathForResource:vidName ofType:@"mov"];
if (moviePath)
mMovieURL = [NSURL fileURLWithPath:moviePath];
if (vidName == @"Vid01")
vidName = @"Vid02";
else if (vidName == @"Vid02")
vidName = @"Vid03";
}
return mMovieURL;
}
- (void)onHitButton1 {
mMoviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:[self movieURL]];
mMoviePlayer.movieControlMode = MPMovieControlModeHidden;
[mMoviePlayer play];
}