安装了Xcode 4.5,MPMoviePlayerController不再工作了
题
我很高兴看到,当“升级”到Xcode 4.5时,现在我的应用程序中都没有视频播放。
一般来说,我做这样的事情:
self.moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:[self getBundleClip:@"theVideo"]];
self.moviePlayer.controlStyle = MPMovieControlStyleNone;
self.moviePlayer.shouldAutoplay = YES;
self.moviePlayer.repeatMode = MPMovieRepeatModeOne;
self.moviePlayer.view.frame = self.container.frame;
self.moviePlayer.view.userInteractionEnabled = NO;
[self.container addSubview:self.moviePlayer.view];
- (NSURL*)getBundleClip:(NSString*)clip
{
NSBundle *bundle = [NSBundle mainBundle];
NSString *moviePath = [bundle pathForResource:clip ofType:@"mp4"];
return [NSURL fileURLWithPath:moviePath];
}
.
再次,在我将Xcode更新为4.5之前,所有内容都会完美播放。其他人都有这个问题?
我也得到这个输出:
[MPAVController] Autoplay: Disabling autoplay for pause
[MPAVController] Autoplay: Disabling autoplay
. 解决方案
我不确定为什么它没有特别播放,但它看起来像行为是不同的,具体取决于你构建的iOS SDK的版本。看看 MPMoviePlayerController
文档。
特别是,您可能需要尝试在电影播放器上调用prepareToPlay
方法。
其他提示
我想你在函数中定义它?
如果使用acc,则必须保留MPMoviePlayerController
将其添加到界面文件!
@property(nonatomic, strong) MPMoviePlayerController *moviePlayer;
. 不隶属于 StackOverflow