0

我很高兴看到当“升级”到 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
4

2 回答 2

4

我想你在函数中定义它?

如果你使用 ARC,你必须保留 MPMoviePlayerController

将其添加到接口文件中!

@property(nonatomic, strong) MPMoviePlayerController *moviePlayer;
于 2012-11-05T07:48:45.100 回答
0

我不确定为什么它没有专门播放,但看起来行为会有所不同,具体取决于您构建的 iOS SDK 版本。查看MPMoviePlayerController文档

特别是,您可能想尝试prepareToPlay在电影播放器​​上调用该方法。

于 2012-10-01T04:55:52.323 回答