[英]MPMoviePlayerController shows blank white screen before launch?
I have an MPMoviePlayerController that I am presenting modally. 我有一个MPMoviePlayerController我以模态方式呈现。 The video loads fine, however just before the video is launched the screen turns white until it has loaded. 视频加载正常,但是在视频启动之前,屏幕变为白色,直到加载完毕。 How can I prevent this from happening? 我怎样才能防止这种情况发生?
moviePlayerViewController = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL URLWithString:mySTVideo.video_url]];
[self presentModalViewController:moviePlayerViewController animated:YES];
Also, you should make sure to set the movieSourceType
on your MPMoviePlayercontroller
(which you can access via moviePlayerViewController.moviePlayer
). 此外,您应确保在movieSourceType
上设置MPMoviePlayercontroller
(您可以通过moviePlayerViewController.moviePlayer
访问moviePlayerViewController.moviePlayer
)。
If you don't set this property, it defaults to MPMovieSourceTypeUnknown
, and the player won't show controls until the request has returned (which can take a while on WWAN ). 如果您未设置此属性,则默认为MPMovieSourceTypeUnknown
,并且在请求返回之前,播放器不会显示控件(这可能需要一段时间才能使用WWAN )。
First, you should be using this for display the movies: 首先,您应该使用它来显示电影:
[self presentMoviePlayerViewControllerAnimated:moviePlayerViewController];
Second, to change the moviePlayerViewController background you can use: 其次,要更改moviePlayerViewController背景,您可以使用:
moviePlayerViewController.view.backgroundColor = [UIColor blackColor];
So when the video is launched the background color will be black. 因此,当视频启动时,背景颜色将为黑色。
Hope its helps... 希望它的帮助......
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.