2

我无法播放视频,因为我收到此通知错误:

    - (void)playbackFinished:(NSNotification*)notification {
        NSNumber* reason = [[notification userInfo] objectForKey:MPMoviePlayerPlaybackDidFinishReasonUserInfoKey];
        switch ([reason intValue]) {

            case MPMovieFinishReasonPlaybackError:{
                **NSLog(@"playbackFinished. Reason: Playback Error");**
                [UIView animateWithDuration:1.0f
                                      delay:0
                                    options:UIViewAnimationOptionCurveEaseIn
                                 animations:^{

                                     [m_player.view setAlpha:0];

                                 }
                                 completion:^(BOOL finished){

                                     [m_player.view removeFromSuperview];
                                     m_player = nil;
                                 }];
            }
                break;

            default:
                break;
        }


 }

任何帮助表示感谢!

4

1 回答 1

1

您需要找出出现播放错误的原因,然后才能弄清楚需要做什么才能解决问题。

查看这个密切相关问题的答案,您会看到以下代码片段:

    NSError *mediaPlayerError = [[notification userInfo] objectForKey:@"error"];
    if (mediaPlayerError) 
    {
        NSLog(@"playback failed with error description: %@", [mediaPlayerError localizedDescription]);
    }
    else
    {
        NSLog(@"playback failed without any given reason");
    }

将这些行添加到您的 MPMovieFinishReasonPlaybackError 案例中,您可能会弄清楚您的应用程序到底发生了什么。祝你好运!

于 2013-09-27T03:04:44.690 回答