Pausing progress if it was playing and the stating again (#526)
This commit is contained in:
parent
be55cef093
commit
087adef1b9
@ -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],
|
||||
|
Loading…
Reference in New Issue
Block a user