Pausing progress if it was playing and the stating again (#526)

This commit is contained in:
Nawal "Deshi" Rahim 2017-03-22 07:25:58 +11:00 committed by Matt Apperson
parent be55cef093
commit 087adef1b9

View File

@ -532,9 +532,12 @@ static NSString *const timedMetadata = @"timedMetadata";
CMTime current = item.currentTime;
// TODO figure out a good tolerance level
CMTime tolerance = CMTimeMake(1000, timeScale);
BOOL wasPaused = _paused;
if (CMTimeCompare(current, cmSeekTime) != 0) {
if (!wasPaused) [_player pause];
[_player seekToTime:cmSeekTime toleranceBefore:tolerance toleranceAfter:tolerance completionHandler:^(BOOL finished) {
if (!wasPaused) [_player play];
if(self.onVideoSeek) {
self.onVideoSeek(@{@"currentTime": [NSNumber numberWithFloat:CMTimeGetSeconds(item.currentTime)],
@"seekTime": [NSNumber numberWithFloat:seekTime],