Sun*_*hah 7 iphone objective-c mpmovieplayercontroller ios ios7
我在iOS 7中面临MPMoviePlayerController的问题.当我单击前向搜索按钮时,视频停止并且不允许执行任何类似于再次播放全屏和滑块更改的操作.
这是我的代码.删除MPMoviePlayerPlaybackDidFinishNotification的Observer
[[NSNotificationCenter defaultCenter] removeObserver:moviePlayerViewController name:MPMoviePlayerPlaybackDidFinishNotification object:moviePlayerViewController.moviePlayer];
Run Code Online (Sandbox Code Playgroud)
并添加新通知MPMoviePlayerPlaybackDidFinishNotification
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(videoFinished:) name:MPMoviePlayerPlaybackDidFinishNotification object:nil];
Run Code Online (Sandbox Code Playgroud)
这是我处理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) {
}
}
Run Code Online (Sandbox Code Playgroud)
我需要在单击时停止这种奇怪的行为并继续播放.
有人知道怎么做吗?谢谢.
我认为用户与标准播放器按钮的交互没有任何通知或事件可用,并且我必须为播放器控件实现自己的 UI。通过这种方式,我们可以确定单次触摸、长触摸等操作。然后,我们可以添加任何功能,例如提高播放速率,或者只是寻找时间。
| 归档时间: |
|
| 查看次数: |
894 次 |
| 最近记录: |