Avatar of carvalhaes
carvalhaes
 asked on

How to add the default buttons (play, pause, >>, etc.) to my iPhone video app?

Hi.

I used this video to make an application where an iPhone shows a video.
However, starting at 4:25, I used another code (the code of the video does not work with the current sdk).

Here's the code that i use:

- (IBAction)playMovie {
	
	NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"MOVIE001" ofType:@"mov"]];  
	MPMoviePlayerController *moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:url];  
	
	// Register to receive a notification when the movie has finished playing.  
	[[NSNotificationCenter defaultCenter] addObserver:self  
											 selector:@selector(moviePlayBackDidFinish:)  
												 name:MPMoviePlayerPlaybackDidFinishNotification  
											   object:moviePlayer];  
	
	if ([moviePlayer respondsToSelector:@selector(setFullscreen:animated:)]) {  
		// Use the new 3.2 style API  
		moviePlayer.controlStyle = MPMovieControlStyleNone;  
		moviePlayer.shouldAutoplay = YES;  
		[self.view addSubview:moviePlayer.view];  
		[moviePlayer setFullscreen:YES animated:YES];  
	} else {  
		// Use the old 2.0 style API  
		moviePlayer.movieControlMode = MPMovieControlModeHidden;  
		[moviePlayer play];  
	}  
	 

}

Open in new window


The application is running ok but when I touch the video i cant see this buttons:
video buttons

What changes should I do in my code to see this buttons?

Thanks and sorry for my bad english!
CSwift Programming

Avatar of undefined
Last Comment
pgnatyuk

8/22/2022 - Mon
pgnatyuk

Probably you have found the answer in the article:
Play iPhone Movies in Portrait Mode with MPMoviePlayerController using Public API’s
http://iphonedevelopertips.com/video/play-movies-in-portrait-mode-with-mpmovieplayercontroller-using-public-apis.html
ASKER CERTIFIED SOLUTION
pgnatyuk

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
pgnatyuk

Can you use MPMoviePlayerViewController in your program?
carvalhaes

ASKER
this link is very interesting http://iphonedevelopertips.com/video/play-movies-in-portrait-mode-with-mpmovieplayercontroller-using-public-apis.html
but when i try to build it i got an error ''there is no sdk with the name or path iphoneos3.0'

you already awser my question with "moviePlayer.controlStyle = MPMovieControlStyleNone;
This line hides the controls".

thank you very much!
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
pgnatyuk

It's again the same - change the base SDK in the settings - right click on the project and then "Get Info", then "Build", ...
Let's switch to the view controller.