Update progress every 250ms

This commit is contained in:
Brent Vatne 2015-04-06 13:26:11 -07:00
parent d22d75c332
commit d52e83d901

View File

@ -26,7 +26,7 @@
_eventDispatcher = eventDispatcher; _eventDispatcher = eventDispatcher;
/* Initialize videoProgress status publisher */ /* Initialize videoProgress status publisher */
_progressUpdateInterval = 1; _progressUpdateInterval = 250;
_prevProgressUpdateTime = nil; _prevProgressUpdateTime = nil;
_progressUpdateTimer = [CADisplayLink displayLinkWithTarget:self selector:@selector(sendProgressUpdate)]; _progressUpdateTimer = [CADisplayLink displayLinkWithTarget:self selector:@selector(sendProgressUpdate)];
[_progressUpdateTimer addToRunLoop:[NSRunLoop mainRunLoop] forMode:NSDefaultRunLoopMode]; [_progressUpdateTimer addToRunLoop:[NSRunLoop mainRunLoop] forMode:NSDefaultRunLoopMode];
@ -41,8 +41,8 @@
return; return;
} }
if (_prevProgressUpdateTime == nil || if (_prevProgressUpdateTime == nil ||
((int) [[NSDate date] timeIntervalSinceDate: _prevProgressUpdateTime]) >= _progressUpdateInterval) { (([_prevProgressUpdateTime timeIntervalSinceNow] * -1000.0) >= _progressUpdateInterval)) {
[_eventDispatcher sendInputEventWithName:@"videoProgress" body:@{ [_eventDispatcher sendInputEventWithName:@"videoProgress" body:@{
@"currentTime": [NSNumber numberWithFloat:CMTimeGetSeconds(video.currentTime)], @"currentTime": [NSNumber numberWithFloat:CMTimeGetSeconds(video.currentTime)],
@"target": self.reactTag @"target": self.reactTag