mirror of
https://github.com/zoriya/react-native-video.git
synced 2026-05-23 15:07:45 +00:00
fix(ios): handle fullscreen transition cancellation events (#4833)
This commit is contained in:
@@ -123,9 +123,16 @@ class VideoComponentViewObserver: NSObject, AVPlayerViewControllerDelegate {
|
||||
willEndFullScreenPresentationWithAnimationCoordinator coordinator: UIViewControllerTransitionCoordinator
|
||||
) {
|
||||
delegate?.willExitFullscreen()
|
||||
|
||||
coordinator.animate(alongsideTransition: nil) { [weak self] _ in
|
||||
|
||||
coordinator.animate(alongsideTransition: nil) { [weak self] context in
|
||||
guard let self = self else { return }
|
||||
|
||||
if context.isCancelled {
|
||||
self.delegate?.willEnterFullscreen()
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
self.delegate?.onFullscreenChange(false)
|
||||
}
|
||||
}
|
||||
@@ -135,9 +142,16 @@ class VideoComponentViewObserver: NSObject, AVPlayerViewControllerDelegate {
|
||||
willBeginFullScreenPresentationWithAnimationCoordinator coordinator: UIViewControllerTransitionCoordinator
|
||||
) {
|
||||
delegate?.willEnterFullscreen()
|
||||
|
||||
coordinator.animate(alongsideTransition: nil) { [weak self] _ in
|
||||
|
||||
coordinator.animate(alongsideTransition: nil) { [weak self] context in
|
||||
guard let self = self else { return }
|
||||
|
||||
if context.isCancelled {
|
||||
self.delegate?.willExitFullscreen()
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
self.delegate?.onFullscreenChange(true)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user