Skip to content

Commit

Permalink
Merge pull request #2971 from somersets/fix/ios_crash_presentFullScre…
Browse files Browse the repository at this point in the history
…enPlayer

Fix(ios): crash present full screen player
  • Loading branch information
freeboub authored Jan 2, 2023
2 parents 4878049 + 045f51e commit 5b0fd0e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

### Version 6.0.0-alpha.4

- Fix: iOS app crashes on call to presentFullScreenPlayer [#2808](https://github.com/react-native-video/react-native-video/pull/2971)
- ensure src is always provided to native player even if it is invalid [#2857](https://github.com/react-native-video/react-native-video/pull/2857)
- Sample: Add react-native-video controls support [#2852](https://github.com/react-native-video/react-native-video/pull/2852)
- Android: Switch Google's maven repository to default `google()` [#2860](https://github.com/react-native-video/react-native-video/pull/2860)
Expand Down
16 changes: 9 additions & 7 deletions ios/Video/RCTVideo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ class RCTVideo: UIView, RCTVideoPlayerViewControllerDelegate, RCTPlayerObserverH
"target": self.reactTag
])
}.catch{_ in }
_videoLoadStarted = true
self._videoLoadStarted = true
}
}

Expand Down Expand Up @@ -635,14 +635,16 @@ class RCTVideo: UIView, RCTVideoPlayerViewControllerDelegate, RCTPlayerObserverH

self.onVideoFullscreenPlayerWillPresent?(["target": reactTag as Any])

viewController.present(viewController, animated:true, completion:{
self._playerViewController?.showsPlaybackControls = true
self._fullscreenPlayerPresented = fullscreen
self._playerViewController?.autorotate = self._fullscreenAutorotate
if let playerViewController = _playerViewController {
viewController.present(playerViewController, animated:true, completion:{
self._playerViewController?.showsPlaybackControls = true
self._fullscreenPlayerPresented = fullscreen
self._playerViewController?.autorotate = self._fullscreenAutorotate

self.onVideoFullscreenPlayerDidPresent?(["target": self.reactTag])
self.onVideoFullscreenPlayerDidPresent?(["target": self.reactTag])

})
})
}
}
} else if !fullscreen && _fullscreenPlayerPresented, let _playerViewController = _playerViewController {
self.videoPlayerViewControllerWillDismiss(playerViewController: _playerViewController)
Expand Down

0 comments on commit 5b0fd0e

Please sign in to comment.