Unverified Commit 6c139a78 authored by Hampton Maxwell's avatar Hampton Maxwell Committed by GitHub
Browse files

Merge pull request #800 from tablexi/allow-progress-update-interval-to-work-on-ios

Allow setting progressUpdateInterval to work on iOS
parents f0de6bbc fd8ebbd7
Loading
Loading
Loading
Loading
+7 −1
Changes for ios/RCTVideo.m: 7 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -127,7 +127,8 @@ static NSString *const timedMetadata = @"timedMetadata";
-(void)addPlayerTimeObserver
{
  const Float64 progressUpdateIntervalMS = _progressUpdateInterval / 1000;
    // @see endScrubbing in AVPlayerDemoPlaybackViewController.m of https://developer.apple.com/library/ios/samplecode/AVPlayerDemo/Introduction/Intro.html
  // @see endScrubbing in AVPlayerDemoPlaybackViewController.m
  // of https://developer.apple.com/library/ios/samplecode/AVPlayerDemo/Introduction/Intro.html
  __weak RCTVideo *weakSelf = self;
  _timeObserver = [_player addPeriodicTimeObserverForInterval:CMTimeMakeWithSeconds(progressUpdateIntervalMS, NSEC_PER_SEC)
                                                        queue:NULL
@@ -738,6 +739,11 @@ static NSString *const timedMetadata = @"timedMetadata";
- (void)setProgressUpdateInterval:(float)progressUpdateInterval
{
  _progressUpdateInterval = progressUpdateInterval;

  if (_timeObserver) {
    [self removePlayerTimeObserver];
    [self addPlayerTimeObserver];
  }
}

- (void)removePlayerLayer