Ios MPMoviePlayerPlaybackDidFinish视频失败时的通知

Ios MPMoviePlayerPlaybackDidFinish视频失败时的通知,ios,mpmovieplayercontroller,Ios,Mpmovieplayercontroller,我需要在MPMoviePlayerController由于错误而结束播放或视频刚刚结束时做出改变。我使用我这样处理的mpmovieplayerplaybackdidfishnotification - (void)moviePlayerPlaybackDidFinish:(NSNotification *)notification { NSDictionary *notificationUserInfo = [notification userInfo]; NSNumber *r

我需要在
MPMoviePlayerController
由于错误而结束播放或视频刚刚结束时做出改变。我使用我这样处理的
mpmovieplayerplaybackdidfishnotification

- (void)moviePlayerPlaybackDidFinish:(NSNotification *)notification
{
    NSDictionary *notificationUserInfo = [notification userInfo];
    NSNumber *resultValue = notificationUserInfo[MPMoviePlayerPlaybackDidFinishReasonUserInfoKey];
    MPMovieFinishReason reason = (MPMovieFinishReason) [resultValue intValue];
    if (reason == MPMovieFinishReasonPlaybackError) {
        NSLog(@"playback failed without any given reason");

    }
    if (reason == MPMovieFinishReasonPlaybackEnded) {
        NSLog(@"playback ended");
    }
}
问题是,即使视频失败,
MPMovieFinishReason
也会
mpmoviefinishreasonlaybackend

当我的视频失败时,我注意到就在
mpmovieplayerplaybackdidfishnotification
之前发布了
avplayertimfailedtoplaytoendtimenotification
。它包含此用户信息

{
    AVPlayerItemFailedToPlayToEndTimeErrorKey = "Error Domain=AVFoundationErrorDomain Code=-11800 \"The operation could not be completed\" UserInfo=0x78f621c0 {NSLocalizedDescription=The operation could not be completed, NSUnderlyingError=0x794f3a30 \"The operation couldn\U2019t be completed. (OSStatus error -12551.)\", NSLocalizedFailureReason=An unknown error occurred (-12551)}";
}
我可以将其用作解决方法,以便在控制器中设置一个状态,例如:self.failedToPlayToEnd=YESmoviePlayerPlaybackDidFinish方法中使用它。这似乎不对,因为没有任何东西能保证这两个通知的顺序

所以问题是,我如何确定视频无法播放。顺便说一句,我说的是播放失败的时候,而不是暂停的时候

在结束前2秒失败