How to show “Loading Movie…” message with MPMoviePlayerController

老子叫甜甜 提交于 2019-12-07 08:45:52

问题


I'm working with the MPMoviePlayerController for the iOS platform and am not sure why the "Done" and "Loading Movie..." controls are not displaying automatically when loading a new video.

My original implementation of this was to use the UIWebView control to stream the videos, and when the videos are accessed, the "Done" and "Loading Movie..." controls are displayed until the video is loaded and ready to play. I would like to reproduce the same user experience with the MPMoviePlayerController.

Should I get the "Done" and "Loading Movie..." control overlays for free? If not, what do I have to set to get them to show up while the video is loading?

NSURL *videoUrl = [NSURL URLWithString:urlString];
self.moviePlayer = [[[MPMoviePlayerController alloc] init] autorelease];
self.moviePlayer.movieControlMode = MPMovieControlModeDefault;

[self.moviePlayer setContentURL:videoUrl];
[self.moviePlayer prepareToPlay];

[self.view addSubview:self.moviePlayer.view]; 
[[self.moviePlayer view] setFrame: [self.view bounds]];
[self.moviePlayer setFullscreen:YES animated:YES];

回答1:


This is answer to your follow-up question, but anyways... You can speed-up things a little bit with this:

prepareToPlay
Prepares the current item for playback. (required)

- (void)prepareToPlay  

This method is called automatically when you call the play method. Calling it before you call play gives the receiver a chance to prepare items sooner and may result in decreased latency when starting playback. However, calling this method may also interrupt any active audio sessions.

Available in iOS 3.2 and later. Declared In MPMediaPlayback.h



来源:https://stackoverflow.com/questions/4877739/how-to-show-loading-movie-message-with-mpmovieplayercontroller

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!