开发者

How to show "Loading Movie..." message with MPMoviePlayerController

开发者 https://www.devze.com 2023-02-08 08:12 出处:网络
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.

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.moviePlay开发者_运维问答er setContentURL:videoUrl];
[self.moviePlayer prepareToPlay];

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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号