Merge pull request #3017 from iFeelSmart/fix/avoid_controls_to_be_displayed_when_controls_is_true

fix(ios): ensure controls are not displayed when disabled by user
This commit is contained in:
Olivier Bouillet 2023-02-07 21:51:13 +01:00 committed by GitHub
commit f1c7bdbca1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 15 deletions

View File

@ -2,12 +2,13 @@
### Version 6.0.0-alpha.5 ### Version 6.0.0-alpha.5
- Android: add new events on tracks changed to be notified of audio/text/video Tracks update during playback [2806](https://github.com/react-native-video/react-native-video/pull/2806) - iOS: ensure controls are not displayed when disabled by user [#3017](https://github.com/react-native-video/react-native-video/pull/3017)
- iOS: app crashes on call to presentFullScreenPlayer [#2808](https://github.com/react-native-video/react-native-video/pull/2971) - iOS: app crashes on call to presentFullScreenPlayer [#2808](https://github.com/react-native-video/react-native-video/pull/2971)
- Android: Fix publicated progress handler causing duplicated progress event [#2972](https://github.com/react-native-video/react-native-video/pull/2972) - Android: Fix publicated progress handler causing duplicated progress event [#2972](https://github.com/react-native-video/react-native-video/pull/2972)
- Android: Fix audio/Subtitle tracks selection [#2979](https://github.com/react-native-video/react-native-video/pull/2979) - Android: Fix audio/Subtitle tracks selection [#2979](https://github.com/react-native-video/react-native-video/pull/2979)
- Feature: Add VAST support for AVOD [#2923](https://github.com/react-native-video/react-native-video/pull/2923) - Android: add new events on tracks changed to be notified of audio/text/video Tracks update during playback [2806](https://github.com/react-native-video/react-native-video/pull/2806)
- Sample: Upgrade react-native version of basic sample [#2960](https://github.com/react-native-video/react-native-video/pull/2960) - Feature: Add VAST support for AVOD [#2923](https://github.com/react-native-video/react-native-video/pull/2923)
- Sample: Upgrade react-native version of basic sample [#2960](https://github.com/react-native-video/react-native-video/pull/2960)
### Version 6.0.0-alpha.4 ### Version 6.0.0-alpha.4

View File

@ -614,7 +614,7 @@ class RCTVideo: UIView, RCTVideoPlayerViewControllerDelegate, RCTPlayerObserverH
func setFullscreen(_ fullscreen:Bool) { func setFullscreen(_ fullscreen:Bool) {
if fullscreen && !_fullscreenPlayerPresented && _player != nil { if fullscreen && !_fullscreenPlayerPresented && _player != nil {
// Ensure player view controller is not null // Ensure player view controller is not null
if _playerViewController == nil { if _playerViewController == nil && _controls {
self.usePlayerViewController() self.usePlayerViewController()
} }
@ -638,7 +638,7 @@ class RCTVideo: UIView, RCTVideoPlayerViewControllerDelegate, RCTPlayerObserverH
if let playerViewController = _playerViewController { if let playerViewController = _playerViewController {
viewController.present(playerViewController, animated:true, completion:{ viewController.present(playerViewController, animated:true, completion:{
self._playerViewController?.showsPlaybackControls = true self._playerViewController?.showsPlaybackControls = self._controls
self._fullscreenPlayerPresented = fullscreen self._fullscreenPlayerPresented = fullscreen
self._playerViewController?.autorotate = self._fullscreenAutorotate self._playerViewController?.autorotate = self._fullscreenAutorotate
@ -694,7 +694,7 @@ class RCTVideo: UIView, RCTVideoPlayerViewControllerDelegate, RCTPlayerObserverH
func createPlayerViewController(player:AVPlayer, withPlayerItem playerItem:AVPlayerItem) -> RCTVideoPlayerViewController { func createPlayerViewController(player:AVPlayer, withPlayerItem playerItem:AVPlayerItem) -> RCTVideoPlayerViewController {
let viewController = RCTVideoPlayerViewController() let viewController = RCTVideoPlayerViewController()
viewController.showsPlaybackControls = true viewController.showsPlaybackControls = self._controls
viewController.rctDelegate = self viewController.rctDelegate = self
viewController.preferredOrientation = _fullscreenOrientation viewController.preferredOrientation = _fullscreenOrientation
@ -836,12 +836,6 @@ class RCTVideo: UIView, RCTVideoPlayerViewControllerDelegate, RCTPlayerObserverH
// MARK: - React View Management // MARK: - React View Management
func insertReactSubview(view:UIView!, atIndex:Int) { 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 { if _controls {
view.frame = self.bounds view.frame = self.bounds
_playerViewController?.contentOverlayView?.insertSubview(view, at:atIndex) _playerViewController?.contentOverlayView?.insertSubview(view, at:atIndex)