MPMoviePlayerController以全屏模式向前搜索,直到结束卡住 [英] MPMoviePlayerController seek forward in fullscreen mode until end is stuck

查看:105
本文介绍了MPMoviePlayerController以全屏模式向前搜索,直到结束卡住的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

MPMoviePlayerController似乎存在问题,一旦你处于全屏模式并按住快进按钮,让它向前搜索(以快速播放)一直到视频结尾。

There seems to be a problem with the MPMoviePlayerController where once you're in fullscreen mode and you hold down the fast forward button, letting it seek forward (playing at fast speed) all the way to the end of the video.

此后,你只是得到一个黑屏,它被卡住了。换句话说,它不响应任何轻击手势,你无法摆脱这种情况。还有其他人遇到过这个问题吗?

Thereafter the you just get a black screen and it's stuck. In other words it does not respond to any taps gestures and you can not get out of this situation. Has anyone else encountered this problem?

无论如何都要在代码中解决它吗?

Is there anyway to work around it in code?

推荐答案

这似乎是一个iOS错误,因为快速向后到一开始不会导致黑屏,但快进到最后,然后播放/暂停调用视频球员从不工作。我暂时通过在scrubber刷新回调中添加受保护的逻辑来解决这个问题:
让我们假设在'PLAY_BACK_TIME_MONITOR_INTERVAL'秒期间调用monitorPlaybackTime来刷新擦除器,并在其中添加一个检查逻辑:

It seems it's an iOS bug since fast backward to the very beginning won't cause the black screen but fast forward to the end will, and after that the 'play'/'pause' call to the video player never works. I temporarily fix this by adding protected logic into the scrubber refresh callback: let's assume that monitorPlaybackTime will be called in 'PLAY_BACK_TIME_MONITOR_INTERVAL' seconds period to refresh the scrubber, and in it I add a check logic:

NSTimeInterval duration = self.moviePlayer.duration;
NSTimeInterval current = self.moviePlayer.currentPlaybackTime;

if (isnan(current) || current > duration) {
    current = duration;
} else if (self.moviePlayer.playbackState == MPMoviePlaybackStateSeekingForward) {
    if (current + self.moviePlayer.currentPlaybackRate*PLAY_BACK_TIME_MONITOR_INTERVAL > duration) {
        [self.moviePlayer endSeeking];
    }
}

解决黑屏的解决方法,不完美,希望它可以提供帮助。

A workaround to solve the black screen, not perfect, hope it can help.

这篇关于MPMoviePlayerController以全屏模式向前搜索,直到结束卡住的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆