我在iOS 7中面临MPMoviePlayerController的问题.当我单击前向搜索按钮时,视频停止并且不允许执行任何类似于再次播放全屏和滑块更改的操作.
这是我的代码.
删除MPMoviePlayerPlaybackDidFinishNotification的Observer
[[NSNotificationCenter defaultCenter] removeObserver:moviePlayerViewController name:MPMoviePlayerPlaybackDidFinishNotification object:moviePlayerViewController.moviePlayer];@H_502_6@并添加新通知MPMoviePlayerPlaybackDidFinishNotification
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(videoFinished:) name:MPMoviePlayerPlaybackDidFinishNotification object:nil];@H_502_6@这是我处理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) { } }@H_502_6@我需要在单击时停止这种奇怪的行为并继续播放.
有人知道怎么做吗?
谢谢.
解决方法
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.