Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MPMoviePlayerController seek forward in fullscreen mode until end is stuck

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?

like image 282
hey68you Avatar asked Aug 08 '11 13:08

hey68you


1 Answers

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.

like image 123
Chengjiong Avatar answered Nov 02 '22 14:11

Chengjiong