在媒体加载期间显示MPMoviePlayerController

时间:2011-08-31 19:46:39

标签: ios screen mpmovieplayercontroller loading

我使用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在其顶部栏中显示“Loading ...”标签和UIActiviyIndi​​cator,如YouTube视频。

我该怎么做?

感谢。

1 个答案:

答案 0 :(得分:1)

只需使用MPMoviePlayerViewController而不是MPMoviePlayerController。它应该做你想要的。