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,6 +321,7 @@ 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) {
dispatch_async(dispatch_get_main_queue(), ^{
[_player seekToTime:cmSeekTime toleranceBefore:tolerance toleranceAfter:tolerance completionHandler:^(BOOL finished) { [_player seekToTime:cmSeekTime toleranceBefore:tolerance toleranceAfter:tolerance completionHandler:^(BOOL finished) {
[_eventDispatcher sendInputEventWithName:RNVideoEventSeek body:@{ [_eventDispatcher sendInputEventWithName:RNVideoEventSeek body:@{
@"currentTime": [NSNumber numberWithFloat:CMTimeGetSeconds(item.currentTime)], @"currentTime": [NSNumber numberWithFloat:CMTimeGetSeconds(item.currentTime)],
@ -328,6 +329,7 @@ static NSString *const statusKeyPath = @"status";
@"target": self.reactTag @"target": self.reactTag
}]; }];
}]; }];
});
_pendingSeek = false; _pendingSeek = false;
} }