ios - MPMoviePlayerController 寻找前进按钮停止 IOS7 中的视频?

标签 ios iphone objective-c ios7 mpmovieplayercontroller

我在 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/

相关文章:

ios - 如何在 ios 中获取动画 uiview 的当前位置

iphone - "Overscroll"一个 TableView

objective-c - NSCopying 和 copyWithZone : - should they return [self retain] or something else?

objective-c - 为什么 GHUnit 中的异步测试中的错误断言会导致应用程序崩溃,而不仅仅是测试失败?

iphone - 在 NSString 的特定行分割字符串

iphone - 如何在 iPhone 中为透明的 PNG 图像着色?

ios - 在可缩放的 UIView 中保留 CAShapeLayer 的 lineWidth

ios - 点击 UITableViewCell 时应用程序崩溃

iphone - 导航栏的圆角半径

php - xcode mysql php错误