Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Better way to make MPMoviePlayer with Overlay view

When we creating application with MPMoviePlayer (within custom UIViewController) and with overlay UIViewController on top of movie player what is better: - Load movie in player with self.view.presentModalView... or self.view.addSubView... Or is there any other better way. I now work with modal views and everything works except I have to implement some custom rotations. I am looking for more clear way to make this.

Ok maybe some more details. In iPhone app I add player like modal view and add overlay view to it and that works. But this is universal app and it doesn't work on iPad the same way it works on iPhone. In ipad splitView my player is on details side (nonfullscreen), when I double tap player it goes fullscreen. And now player is key window. Here is the biggest issue. I tried to add overlay view as subviw and modal view and I made it but that overlay is not aware of device orientation, and I have to transform overlay elements and this is what I am trying to avoid. Is there any way to detect rotation on that view?

like image 863
1110 Avatar asked Apr 26 '11 10:04

1110


1 Answers

Simple and most elegant solution:

Do not use the "real" fullscreen mode but scale the MPMoviePlayerController's view towards a screen-filling size - MPMoviePlayerController.view.frame = CGRectMake(0.0f, 0.0f, 768.0f, 1024.0f);. Keep the MPMoviePlayerController's view on top of a regular UIViewController's view that allows rotations (addSubview). Keep your custom interface view on top of the MPMoviePlayerController's view (addSubview) and presto, you will get a properly rotating video player no matter if you run it in "fullscreen" or not.

like image 126
Till Avatar answered Sep 27 '22 16:09

Till