From d52e83d901380e7eb0906f5e9d371645f70e5bc2 Mon Sep 17 00:00:00 2001 From: Brent Vatne Date: Mon, 6 Apr 2015 13:26:11 -0700 Subject: [PATCH] Update progress every 250ms --- RCTVideo.m | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/RCTVideo.m b/RCTVideo.m index db991abf..fc9a2179 100644 --- a/RCTVideo.m +++ b/RCTVideo.m @@ -26,7 +26,7 @@ _eventDispatcher = eventDispatcher; /* Initialize videoProgress status publisher */ - _progressUpdateInterval = 1; + _progressUpdateInterval = 250; _prevProgressUpdateTime = nil; _progressUpdateTimer = [CADisplayLink displayLinkWithTarget:self selector:@selector(sendProgressUpdate)]; [_progressUpdateTimer addToRunLoop:[NSRunLoop mainRunLoop] forMode:NSDefaultRunLoopMode]; @@ -41,8 +41,8 @@ return; } - if (_prevProgressUpdateTime == nil || - ((int) [[NSDate date] timeIntervalSinceDate: _prevProgressUpdateTime]) >= _progressUpdateInterval) { + if (_prevProgressUpdateTime == nil || + (([_prevProgressUpdateTime timeIntervalSinceNow] * -1000.0) >= _progressUpdateInterval)) { [_eventDispatcher sendInputEventWithName:@"videoProgress" body:@{ @"currentTime": [NSNumber numberWithFloat:CMTimeGetSeconds(video.currentTime)], @"target": self.reactTag