mirror of
https://github.com/zoriya/react-native-video.git
synced 2026-05-13 19:43:27 +00:00
feat(ios): set playback speed controls to initial playback rate (#4495)
Otherwise, the Video can be initiated with playback rate 0.5 and play correctly (slower), but in native playback speed controls 1.0 will be marked as current playback speed.
This commit is contained in:
committed by
GitHub
parent
697afd52f6
commit
d2e5d9c64e
@@ -1164,6 +1164,14 @@ class RCTVideo: UIView, RCTVideoPlayerViewControllerDelegate, RCTPlayerObserverH
|
||||
|
||||
viewController.view.frame = self.bounds
|
||||
viewController.player = player
|
||||
|
||||
// Set the initial playback speed in controls to match playback rate
|
||||
if #available(iOS 16.0, *) {
|
||||
if let initialSpeed = viewController.speeds.first(where: { $0.rate == _rate }) {
|
||||
viewController.selectSpeed(initialSpeed)
|
||||
}
|
||||
}
|
||||
|
||||
if #available(iOS 9.0, tvOS 14.0, *) {
|
||||
viewController.allowsPictureInPicturePlayback = _enterPictureInPictureOnLeave
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user