From 2032a36969a022c57232baa8f3b9746eff103c28 Mon Sep 17 00:00:00 2001 From: olivier Date: Sat, 28 Jan 2023 14:40:45 +0100 Subject: [PATCH] fix(ios): ensure controls are not displayed when disabled by user --- ios/Video/RCTVideo.swift | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/ios/Video/RCTVideo.swift b/ios/Video/RCTVideo.swift index baca4d1a..e6bf61f5 100644 --- a/ios/Video/RCTVideo.swift +++ b/ios/Video/RCTVideo.swift @@ -614,7 +614,7 @@ class RCTVideo: UIView, RCTVideoPlayerViewControllerDelegate, RCTPlayerObserverH func setFullscreen(_ fullscreen:Bool) { if fullscreen && !_fullscreenPlayerPresented && _player != nil { // Ensure player view controller is not null - if _playerViewController == nil { + if _playerViewController == nil && _controls { self.usePlayerViewController() } @@ -638,7 +638,7 @@ class RCTVideo: UIView, RCTVideoPlayerViewControllerDelegate, RCTPlayerObserverH if let playerViewController = _playerViewController { viewController.present(playerViewController, animated:true, completion:{ - self._playerViewController?.showsPlaybackControls = true + self._playerViewController?.showsPlaybackControls = self._controls self._fullscreenPlayerPresented = fullscreen self._playerViewController?.autorotate = self._fullscreenAutorotate @@ -694,7 +694,7 @@ class RCTVideo: UIView, RCTVideoPlayerViewControllerDelegate, RCTPlayerObserverH func createPlayerViewController(player:AVPlayer, withPlayerItem playerItem:AVPlayerItem) -> RCTVideoPlayerViewController { let viewController = RCTVideoPlayerViewController() - viewController.showsPlaybackControls = true + viewController.showsPlaybackControls = self._controls viewController.rctDelegate = self viewController.preferredOrientation = _fullscreenOrientation @@ -836,12 +836,6 @@ class RCTVideo: UIView, RCTVideoPlayerViewControllerDelegate, RCTPlayerObserverH // MARK: - React View Management func insertReactSubview(view:UIView!, atIndex:Int) { - // We are early in the game and somebody wants to set a subview. - // That can only be in the context of playerViewController. - if !_controls && (_playerLayer == nil) && (_playerViewController == nil) { - setControls(true) - } - if _controls { view.frame = self.bounds _playerViewController?.contentOverlayView?.insertSubview(view, at:atIndex)