MPMoviePlayerController不会播放

时间:2012-09-19 19:22:53

标签: iphone objective-c ios

感觉这应该是在SO的某个地方。但是我找不到它......

我正在尝试使用MPMoviePlayerController,但问题是没有任何反应。我甚至没有收到错误......

以下是一些代码:

NSURL *movieUrl = [NSURL URLWithString:[attachmentDictionary objectForKey:@"Uri"]];
    NSLog(@"URI %@", movieUrl);
    MPMoviePlayerController *mediaController = [[MPMoviePlayerController alloc] initWithContentURL:movieUrl];


    [mediaController prepareToPlay];
    [mediaController.view setFrame:self.view.bounds];
    [self.view addSubview:mediaController.view];

    [mediaController play];

我已经包含了MediaPlayer Framework和MediaPlayer / MediaPlayer.h。

你知道可能出现什么问题吗?

编辑:

发现我收到此错误代码:

2012-09-28 09:45:57.346 Famorable[178:907] [MPAVController] Autoplay: Disabling autoplay for pause
2012-09-28 09:45:57.348 Famorable[178:907] [MPAVController] Autoplay: Disabling autoplay
2012-09-28 09:45:57.435 Famorable[178:907] [MPAVController] Autoplay: Skipping autoplay, disabled (for current item: 1, on player: 0)

1 个答案:

答案 0 :(得分:2)

我明白了!

通过在播放之前释放MPMoviePlayerController,再次让ARC变得烦人......通过在头文件中声明属性,你很高兴!