Commit 087adef1 authored by Nawal "Deshi" Rahim's avatar Nawal "Deshi" Rahim Committed by Matt Apperson
Browse files

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

parent be55cef0
Loading
Loading
Loading
Loading
+3 −0
Changes for ios/RCTVideo.m: 3 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -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],