Seek to time on main thread
This commit is contained in:
parent
449b97a6c2
commit
f83da614cf
14
RCTVideo.m
14
RCTVideo.m
@ -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;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user