我无法播放视频,因为我收到此通知错误:
- (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;
}
}
感谢任何帮助!
答案 0 :(得分:1)
你需要找出为什么你会收到播放错误,这样你就可以弄清楚需要做些什么才能解决问题。
查看this closely related question的答案,您会看到以下代码段:
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案例中,您可能会发现应用程序的真正含义。祝你好运!