开发者

How do I display video on external monitor while keeping controls on iPad?

My iPad app ha开发者_如何学Gos the option to play videos. I use the MPMoviePlayerViewController class to play my videos.

My question is: if I want to play the videos on an attached external monitor, how do I keep the playback controls on the iPad like YouTube does? If I add the view of the MPMoviePlayerViewController 's player to the external screen's hierarchy I can play the video fine, but I now have no control over it. Is there a way to move or duplicate the view where the controls lie and place it on a view which resides on the iPad?


I'm not aware of an officially supported way of pulling out the original UI in this way. The MPMoviePlayerViewController only exposes the MPMoviePlayerController object it uses via its moviePlayer property. The MPMoviePlayerController in turn only exposes view and backgroundView, which aren't helpful for such a purpose. You could in theory inspect the subviews of the movie player's main view, find the playback controls and try to move them to the other screen. I have a feeling this will not end well though, as they're anything but static. You also never know what will happen in later iOS versions, or if they'll let your hack on the app store. It's probably less trouble to just re-do the UI yourself.

Actually controlling the video playback programmatically is straightforward - the view controller's moviePlayer implements the MPMediaPlayback protocol.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜