I am trying to accomplish on an iPad having a Menu view that has a button and when you tap button .mov clip will play and when it ends Menu view will re-appear. When I start application the Video view appears not the Menu view. You can tap the play button and the video play just fine and at end a blank whit screen appears. Here are the .h & .m files. Please help.
.h
.m
.h
Code:
#import <UIKit/UIKit.h>
#import <MediaPlayer/MediaPlayer.h>
@interface mainMenuViewController : UIViewController {
MPMoviePlayerController *playerViewController;
}
- (IBAction) playVideo;
@end
.m
Code:
#import "mainMenuViewController.h"
@implementation mainMenuViewController
- (void)viewDidLoad {
NSString *url = [[NSBundle mainBundle] pathForResource:@"BeachCompilation" ofType:@"mov"];
MPMoviePlayerViewController *playerViewController = [[MPMoviePlayerViewController alloc]
initWithContentURL:[NSURL fileURLWithPath:url]];
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(movieFinishedCallback:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:[playerViewController moviePlayer]];
WARNING - Local declaration of ‘playerViewContoller’ hides instance variable
[self.view addSubview:playerViewController.view];
WARNING - Local declaration of ‘playerViewContoller’ hides instance variable
[super viewDidLoad];
}
- (IBAction) goToBeachMenu: (NSURL *) url {
//NSLog(@"button works");
MPMoviePlayerController *player = [playerViewController moviePlayer];
WARNING - ‘MpmoviePlayerController’ may not respond to ‘-moviePlyer’
[player play];
}