From d2e5d9c64eeb80143c39ca39fcdc8ba65f40a400 Mon Sep 17 00:00:00 2001 From: Wojciech Ogrodowczyk Date: Wed, 2 Apr 2025 17:37:56 +0200 Subject: [PATCH] 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. --- ios/Video/RCTVideo.swift | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ios/Video/RCTVideo.swift b/ios/Video/RCTVideo.swift index 4f64a03f..fbf24137 100644 --- a/ios/Video/RCTVideo.swift +++ b/ios/Video/RCTVideo.swift @@ -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 }