如何显示“正在加载电影......”使用MPMoviePlayerController的消息 [英] How to show "Loading Movie..." message with MPMoviePlayerController

查看:141
本文介绍了如何显示“正在加载电影......”使用MPMoviePlayerController的消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用iOS平台的MPMoviePlayerController,并且不确定为什么在加载新视频时Done和Loading Movie ...控件没有自动显示。

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.

我最初的实现是使用UIWebView控件来流式传输视频,当访问视频时,完成和正在加载电影...控件将一直显示,直到视频加载并准备播放。我想用MPMoviePlayerController重现相同的用户体验。

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];


推荐答案

这是您的后续问题的答案,但是无论如何......你可以用这个来加速一些事情:

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


prepareToPlay

准备当前项目进行播放。 (必填)

prepareToPlay
Prepares the current item for playback. (required)

- (void)prepareToPlay  

调用play方法时会自动调用此方法。在您打电话之前调用 可让接收者更快地准备项目,并可能在开始播放时减少延迟。但是,调用此方法也可能会中断任何活动的音频会话。

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.

在iOS 3.2及更高版本中可用。
在MPMediaPlayback.h中声明

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

这篇关于如何显示“正在加载电影......”使用MPMoviePlayerController的消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆