我的视频在IOS 8.3和更早的版本上播放得很好。但在IOS 8.4最近的更新之后,视频播放器停止了工作。视频不会被播放,它会立即转到MPMoviePlaybackComplete: method。
Here is my code :
self.player = [[MPMoviePlayerViewController alloc] initWithContentURL:fileURL];
[self.player.moviePlayer setFullscreen:YES animated:YES];
if(subtitlesPathStr){
[self.player.moviePlayer openSRTFileAtPath:subtitlesPathStr
completion:^(BOOL finished) {
// Activate subtitles
[self.player.moviePlayer showSubtitles];
[self.navigationController presentMoviePlayerViewControllerAnimated:self.player];
} failure:^(NSError *error) {
NSLog(@"Error: %@", error.description);
}
];
}else [self.navigationController presentMoviePlayerViewControllerAnimated:self.player];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(MPMoviePlayerLoadStateDidChange:)
name:MPMoviePlayerLoadStateDidChangeNotification
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(MPMoviePlayerDidEnterFullscreenNotification:)
name:MPMoviePlayerDidEnterFullscreenNotification
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(MPMoviePlaybackComplete:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:nil];谁能告诉我如何解决这个问题?
发布于 2015-07-23 18:18:59
添加您的基于playbacktime和playableduration的重置视频方法。
- (void)playbackDidFinish:(NSNotification*)aNotification {
MPMoviePlayerController *moviePlayer = aNotification.object;
NSNumber *reason = [aNotification.userInfo objectForKey:MPMoviePlayerPlaybackDidFinishReasonUserInfoKey];
if ([reason intValue] == MPMovieFinishReasonPlaybackEnded) {
if (moviePlayer.currentPlaybackTime == moviePlayer.playableDuration) {
[moviePlayer stop];
}
}
}https://stackoverflow.com/questions/31311636
复制相似问题