Merge pull request #2167 from redspear/1930-ios-reapply-rate-modifier

Fix: iOS rate is reset to 1.0 after play/pause #1930
This commit is contained in:
Jonas Dalesjö 2021-06-24 17:49:05 +02:00 committed by GitHub
commit db58ba90f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -718,7 +718,10 @@ static int const RCTVideoUnset = -1;
} }
} else if (object == _player) { } else if (object == _player) {
if([keyPath isEqualToString:playbackRate]) { 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], self.onPlaybackRateChange(@{@"playbackRate": [NSNumber numberWithFloat:_player.rate],
@"target": self.reactTag}); @"target": self.reactTag});
} }