Skip to content

Commit

Permalink
Merge pull request #2167 from redspear/1930-ios-reapply-rate-modifier
Browse files Browse the repository at this point in the history
Fix: iOS rate is reset to 1.0 after play/pause #1930
  • Loading branch information
zchwyng authored Jun 24, 2021
2 parents 141192a + 522af9e commit db58ba9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ios/Video/RCTVideo.m
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,10 @@ - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(N
}
} else if (object == _player) {
if([keyPath isEqualToString:playbackRate]) {
if(self.onPlaybackRateChange) {
if (_player.rate > 0 && _rate > 0 && _player.rate != _rate) {
// Playback is resuming, apply rate modifer.
[_player setRate:_rate];
} else if(self.onPlaybackRateChange) {
self.onPlaybackRateChange(@{@"playbackRate": [NSNumber numberWithFloat:_player.rate],
@"target": self.reactTag});
}
Expand Down

0 comments on commit db58ba9

Please sign in to comment.