在媒体加载期间显示 MPMoviePlayerController
我使用 MPMoviePlayerController 播放音频(例如: http://www.stanford .edu/group/edcorner/uploads/podcast/ballmer090506.mp3)或视频(例如:http://video.ted.com/talk/podcast/2011U/None/RicElias_2011U .mp4)
myMoviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:theURL];
myMoviePlayer.view.frame = CGRectMake(-80, 80, 480, 320);
myMoviePlayer.controlStyle = MPMovieControlStyleFullscreen;
myMoviePlayer.movieSourceType = MPMovieSourceTypeFile;
myMoviePlayer.scalingMode = MPMovieScalingModeAspectFit;
myMoviePlayer.useApplicationAudioSession = TRUE;
[myMoviePlayer prepareToPlay];
[myMoviePlayer play];
它工作得很好,我唯一的一个问题是在加载时间(如果我的 3G 信号不好,则在 5 秒到 20 秒之间)接待处),我有黑屏。
我希望 MPMoviePlayerController 在此期间显示“正在加载...”标签和 UIActiviyIndicator 在其顶部栏中,就像 YouTube 视频一样。
我怎样才能做到这一点?
谢谢。
I use a MPMoviePlayerController to play audio (ex: http://www.stanford.edu/group/edcorner/uploads/podcast/ballmer090506.mp3) or video (ex: http://video.ted.com/talk/podcast/2011U/None/RicElias_2011U.mp4)
myMoviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:theURL];
myMoviePlayer.view.frame = CGRectMake(-80, 80, 480, 320);
myMoviePlayer.controlStyle = MPMovieControlStyleFullscreen;
myMoviePlayer.movieSourceType = MPMovieSourceTypeFile;
myMoviePlayer.scalingMode = MPMovieScalingModeAspectFit;
myMoviePlayer.useApplicationAudioSession = TRUE;
[myMoviePlayer prepareToPlay];
[myMoviePlayer play];
It works well, my only one problem is during the loading time (between 5s and 20s if I have a bad 3G reception), I have a black screen.
I would like to have MPMoviePlayerController diplayed with the "Loading..." label and the UIActiviyIndicator in his top bar during this time, like YouTube videos.
How can I do that?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
只需使用 MPMoviePlayerViewController 而不是 MPMoviePlayerController。它应该做你想做的事。
Just use MPMoviePlayerViewController instead of MPMoviePlayerController. It should do what you want.