Merge pull request #800 from tablexi/allow-progress-update-interval-to-work-on-ios
Allow setting progressUpdateInterval to work on iOS
This commit is contained in:
commit
6c139a7821
@ -124,15 +124,16 @@ static NSString *const timedMetadata = @"timedMetadata";
|
|||||||
return (kCMTimeRangeZero);
|
return (kCMTimeRangeZero);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)addPlayerTimeObserver
|
-(void)addPlayerTimeObserver
|
||||||
{
|
{
|
||||||
const Float64 progressUpdateIntervalMS = _progressUpdateInterval / 1000;
|
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
|
||||||
__weak RCTVideo *weakSelf = self;
|
// of https://developer.apple.com/library/ios/samplecode/AVPlayerDemo/Introduction/Intro.html
|
||||||
_timeObserver = [_player addPeriodicTimeObserverForInterval:CMTimeMakeWithSeconds(progressUpdateIntervalMS, NSEC_PER_SEC)
|
__weak RCTVideo *weakSelf = self;
|
||||||
queue:NULL
|
_timeObserver = [_player addPeriodicTimeObserverForInterval:CMTimeMakeWithSeconds(progressUpdateIntervalMS, NSEC_PER_SEC)
|
||||||
usingBlock:^(CMTime time) { [weakSelf sendProgressUpdate]; }
|
queue:NULL
|
||||||
];
|
usingBlock:^(CMTime time) { [weakSelf sendProgressUpdate]; }
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Cancels the previously registered time observer. */
|
/* Cancels the previously registered time observer. */
|
||||||
@ -738,6 +739,11 @@ static NSString *const timedMetadata = @"timedMetadata";
|
|||||||
- (void)setProgressUpdateInterval:(float)progressUpdateInterval
|
- (void)setProgressUpdateInterval:(float)progressUpdateInterval
|
||||||
{
|
{
|
||||||
_progressUpdateInterval = progressUpdateInterval;
|
_progressUpdateInterval = progressUpdateInterval;
|
||||||
|
|
||||||
|
if (_timeObserver) {
|
||||||
|
[self removePlayerTimeObserver];
|
||||||
|
[self addPlayerTimeObserver];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)removePlayerLayer
|
- (void)removePlayerLayer
|
||||||
|
Loading…
Reference in New Issue
Block a user