每当我的应用程序更改显示的动画(循环电影)时,他会暂停直到他最终启动电影。 MoviePlayerConntroller以这种方式创建
self.moviePlayer = [MPMoviePlayerController alloc];
[moviePlayer initWithContentURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"NewChar" ofType:@"m4v"]] ];
// remove playerview from our view (no prob is he isnt attached to any)
[moviePlayer.view removeFromSuperview];
// tell our playerview the size he has to use
moviePlayer.view.frame = CGRectMake(0, 0, 320, 430);
// and add hin to the superview behind everything else
[self.view insertSubview:moviePlayer.view atIndex:0];
// no moviecontrolls
moviePlayer.controlStyle = MPMovieControlStyleNone;
// looping forever
moviePlayer.repeatMode= MPMovieRepeatModeOne;
// let him use his own Audio Session for old devices
moviePlayer.useApplicationAudioSession= NO;
// fix the silly black background on iOS 4.3
moviePlayer.view.backgroundColor = [UIColor clearColor];
以这种方式播放实际电影
[moviePlayer initWithContentURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"Whatever" ofType:@"m4v"]]];
[moviePlayer play];
就像我说的,每次改变电影时,他都需要一段时间才能显示它。在较新的设备上它可以,因为它们更快,但在G2上它有点令人不安。 尝试准备回放,但没有区别。
知道我错过了什么吗?
感谢阅读! :)
答案 0 :(得分:1)
从磁盘加载电影需要花费时间,而在较旧的设备上显然会慢一些。视频有多大?