我在iOS 7中面临MPMoviePlayerController的问题.当我单击前向搜索按钮时,视频停止并且不允许执行任何类似于再次播放全屏和滑块更改的操作.
这是我的代码.
删除MPMoviePlayerPlaybackDidFinishNotification的Observer
[[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.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。