Seek to time on main thread

This commit is contained in:
Baris Sencan 2015-06-26 15:09:10 -07:00
parent 449b97a6c2
commit f83da614cf

View File

@ -321,13 +321,15 @@ static NSString *const statusKeyPath = @"status";
CMTime tolerance = CMTimeMake(1000, timeScale); CMTime tolerance = CMTimeMake(1000, timeScale);
if (CMTimeCompare(current, cmSeekTime) != 0) { if (CMTimeCompare(current, cmSeekTime) != 0) {
[_player seekToTime:cmSeekTime toleranceBefore:tolerance toleranceAfter:tolerance completionHandler:^(BOOL finished) { dispatch_async(dispatch_get_main_queue(), ^{
[_eventDispatcher sendInputEventWithName:RNVideoEventSeek body:@{ [_player seekToTime:cmSeekTime toleranceBefore:tolerance toleranceAfter:tolerance completionHandler:^(BOOL finished) {
@"currentTime": [NSNumber numberWithFloat:CMTimeGetSeconds(item.currentTime)], [_eventDispatcher sendInputEventWithName:RNVideoEventSeek body:@{
@"seekTime": [NSNumber numberWithFloat:seekTime], @"currentTime": [NSNumber numberWithFloat:CMTimeGetSeconds(item.currentTime)],
@"target": self.reactTag @"seekTime": [NSNumber numberWithFloat:seekTime],
@"target": self.reactTag
}];
}]; }];
}]; });
_pendingSeek = false; _pendingSeek = false;
} }