MPMoviePlayerController not showing controls until

2019-05-10 08:21发布

问题:

I've an application based on iOS4, with a:

MPMoviePlayerController

and this settings:

moviePlayerController.movieSourceType = MPMovieSourceTypeStreaming;
moviePlayerController.controlStyle = MPMovieControlStyleDefault;

Everything is working good, except that, when I present the MPMoviePlayerController view, it doesn't display controls until the video is pre-loaded.

I know in previous version of iOS (3.x), controls are displayed as soon as MPMoviePlayer is presented. Any chance to have this working in ioS4?

回答1:

You have to use MPMoviePlayerViewController instead of MPMoviePlayerController.



回答2:

I'm working on a video player for iPad and I'm experiencing the same behavior. However, I don't think it's much of a problem since you can't control the video until it's loaded anyway.

What you can do is fake the existence of those controls, by setting the background view.

Here's what I do:

moviePlayerController.backgroundView.backgroundColor = [UIColor blackColor];

That just makes the background view black, but you could imagine adding a UIImageView as background view that shows disabled controls, or build real controls that actually do something.