我在 iOS 7 中面临 MPMoviePlayerController 的问题。当我单击向前搜索按钮时,视频停止并且不允许执行任何操作,例如全屏播放和 slider 更改。
这是我的代码。 移除 MPMoviePlayerPlaybackDidFinishNotification
的观察者[[NSNotificationCenter defaultCenter] removeObserver:moviePlayerViewController name:MPMoviePlayerPlaybackDidFinishNotification object:moviePlayerViewController.moviePlayer];
并添加新通知 MPMoviePlayerPlaybackDidFinishNotification
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(videoFinished:) name:MPMoviePlayerPlaybackDidFinishNotification object:nil];
这是我处理 MPMoviePlayerPlaybackDidFinishNotification
的自定义方法-(void)videoFinished:(NSNotification*)aNotification{
MPMoviePlayerController *moviePlayer = [aNotification object];
NSLog(@"%f",moviePlayer.currentPlaybackTime);
int reason = [[[aNotification userInfo] valueForKey:MPMoviePlayerPlaybackDidFinishReasonUserInfoKey] intValue];
if (reason == MPMovieFinishReasonPlaybackEnded) {
}else if (reason == MPMovieFinishReasonUserExited) {
[self performSelector:@selector(dismiss:) withObject:aNotification afterDelay:0.5];
}else if (reason == MPMovieFinishReasonPlaybackError) {
}
}
我需要通过单击来停止这种奇怪的行为并继续播放。
有人知道怎么做吗? 谢谢。
最佳答案
I think there are no any notifications or event are available on user interaction with the standard player buttons, and i have to implement own UI for the player controls. by this way we can then determine the actions for a single touch, long touch, etc. Then, we can add whatever functionality like increasing the play rate, or simply seeking to a time.
关于ios - MPMoviePlayerController 寻找前进按钮停止 IOS7 中的视频?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20585661/