我有一个带有MPMoviePlayerController的iOS应用程序,我需要播放来自URL的视频。一切似乎都运行正常,但当播放结束时,MPMoviePlayerController显示一个奇怪的图像,并且需要AGES来重播视频......
这是我到目前为止所做的:
mp = [[MPMoviePlayerController alloc] initWithContentURL:movieURL];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moviePlayerLoadStateChanged:)
name:MPMoviePlayerLoadStateDidChangeNotification
object:nil];
moviePlayerLoadStateChanged和moviePlayBackDidFinish看起来像这样:
- (void) moviePlayerLoadStateChanged:(NSNotification*)notification
{
if ([mp loadState] != MPMovieLoadStateUnknown)
{
[[NSNotificationCenter defaultCenter]removeObserver:self
name:MPMoviePlayerLoadStateDidChangeNotification
object:nil];
[mp setControlStyle:MPMovieControlStyleEmbedded];
[mp setFullscreen:NO];
[mp.view setFrame:CGRectMake(10, 54, 300, 200)];
[mp setShouldAutoplay:NO];
[mp prepareToPlay];
[[self view] addSubview:[self.mp view]];
}
}
我不知道那张图片是什么,但我想替换它...我觉得它需要这么多,因为它是从URL加载视频,我不知道如何添加加载,还是一个旋转器...任何想法?
答案 0 :(得分:1)
您可以将repeatMode
的{{1}}属性设置为MPMoviePlayerController
使用:
MPMovieRepeatModeOne
如果我理解你的问题,我希望这会有所帮助。 如果不是,我建议您查看文档HERE
快乐编码:)