diff --git a/ios/ReactNativeVideoPlayerView.mm b/ios/ReactNativeVideoPlayerView.mm index 31bfe6c..038f006 100644 --- a/ios/ReactNativeVideoPlayerView.mm +++ b/ios/ReactNativeVideoPlayerView.mm @@ -113,8 +113,7 @@ -(void)dealloc - (void)playerItemDidPlayToEndTime:(NSNotification *)notification { if (_loop) { - [_player seekToTime:kCMTimeZero]; - [_player play]; + [self seekTo:0]; } else { [self emitOnEnd]; } @@ -183,7 +182,7 @@ - (void)setPaused:(BOOL)paused - (void)setSeek:(Float64)seek { - [_player seekToTime:CMTimeMakeWithSeconds(seek, NSEC_PER_SEC)]; + [self seekTo:seek]; } - (void)setVolume:(float)volume @@ -238,7 +237,13 @@ - (void)pause - (void)seekTo:(Float64)time { - [_player seekToTime:CMTimeMakeWithSeconds(time, NSEC_PER_SEC)]; + [_player seekToTime:CMTimeMakeWithSeconds(time, NSEC_PER_SEC) completionHandler:^(BOOL finished) { + if (finished) { + if (!_paused) { + [_player play]; + } + } + }]; } - (void)stop