fix(ios): workaround for rate change (#3657)

* fix(ts): onPlaybackRateChangeData was not correctly typed

* fix(ios): add a workaround for smooth rate change management
This commit is contained in:
Olivier Bouillet 2024-04-07 19:04:43 +02:00 committed by GitHub
parent e82f9dc24b
commit e26afac403
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -732,8 +732,20 @@ class RCTVideo: UIView, RCTVideoPlayerViewControllerDelegate, RCTPlayerObserverH
@objc @objc
func setRate(_ rate: Float) { func setRate(_ rate: Float) {
_rate = rate if _rate != 1 {
applyModifiers() // This is a workaround
// when player change from rate != 1 to another rate != 1 we see some video blocking
// To bypass it we shall force the rate to 1 and apply real valut afterward
_player?.rate = 1
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
self._rate = rate
self.applyModifiers()
}
} else {
// apply it directly
self._rate = rate
self.applyModifiers()
}
} }
@objc @objc