Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Michael H

macrumors newbie
Original poster
Jan 26, 2008
22
0
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

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];
	
}
 
1. Name the local playerViewController variable from the viewDidLoad something different than the instance variable of the same name.

2. You sure you want to add the subView in viewDidLoad and not in the button's action?

3. What does the code for the movieFinishedCallback: look like?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.