Skip to content

Commit

Permalink
fix(iOS): fix video always pause on seek
Browse files Browse the repository at this point in the history
  • Loading branch information
hans00 committed Sep 18, 2023
1 parent 0f6a489 commit a93992c
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions ios/ReactNativeVideoPlayerView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@ -(void)dealloc
- (void)playerItemDidPlayToEndTime:(NSNotification *)notification
{
if (_loop) {
[_player seekToTime:kCMTimeZero];
[_player play];
[self seekTo:0];
} else {
[self emitOnEnd];
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit a93992c

Please sign in to comment.