Best way to make MPMoviePlayer labeled Overlay

When we create an application with MPMoviePlayer (inside the user-defined UIViewController) and overlaying the UIViewController on top of the player, which is better: - Download the movie to the player using self.view.presentModalView ... or self.view.addSubView ... Or is there another other better way . Now I work with modal representations, and everything works, except that I need to perform some custom rotations. I am looking for a clearer way to do this.

Well, maybe more detailed information. In the iPhone app, I add a player that looks like a modal one, and add an overlay view on it, and it works. But this is a universal application, and it does not work on the iPad in the same way as on the iPhone. In the ipad splitView, my player is on the side of the detail (nonfullscreen), when I play the player twice, it becomes full screen. And now the player is the key window. Here is the biggest problem. I tried to add the overlay view as a subvisor and modal view, and I did it, but the overlay does not know the orientation of the device, and I need to transform the overlay elements, and this I try to avoid. Is there any way to detect a twist in this view?

+5
source share
3 answers

Simple and elegant solution:

Do not use the "real" full-screen mode, but scale the MPMoviePlayerController view to the size of the screen fill MPMoviePlayerController.view.frame = CGRectMake(0.0f, 0.0f, 768.0f, 1024.0f);. Hold MPMoviePlayerController viewon top of a regular UIViewController viewone that allows you to rotate (addSubview). Keep your user interface in the MPMoviePlayerController (addSubview) and presto view, you will get a properly rotating video player whether you run it in full screen or not.

+6
source

, , , , : - , . - (UISplitView) willAnimateRotationToInterfaceOrientation . . - , , .

0

- :

mp = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL URLWithString:@"http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8"]];

mp.movieSourceType = MPMovieSourceTypeStreaming;

mp.view.frame = CGRectMake(0.0f, 0.0f, 1024.0f, 768.0f);

[self.view addSubview:mp.view];

mp.controlStyle = MPMovieControlStyleNone;

[self.view addSubview:self.myOverlay];


[mp play];

! "" .

0

All Articles