Skip to content

Commit 0878763

Browse files
committed
Set playback speed controls to initial playback rate
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.
1 parent 697afd5 commit 0878763

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

ios/Video/RCTVideo.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1164,6 +1164,14 @@ class RCTVideo: UIView, RCTVideoPlayerViewControllerDelegate, RCTPlayerObserverH
11641164

11651165
viewController.view.frame = self.bounds
11661166
viewController.player = player
1167+
1168+
// Set the initial playback speed in controls to match playback rate
1169+
if #available(iOS 16.0, *) {
1170+
if let initialSpeed = viewController.speeds.first(where: { $0.rate == _rate }) {
1171+
viewController.selectSpeed(initialSpeed)
1172+
}
1173+
}
1174+
11671175
if #available(iOS 9.0, tvOS 14.0, *) {
11681176
viewController.allowsPictureInPicturePlayback = _enterPictureInPictureOnLeave
11691177
}

0 commit comments

Comments
 (0)