mirror of
https://github.com/zoriya/react-native-video.git
synced 2026-06-03 03:11:47 +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
|
willEndFullScreenPresentationWithAnimationCoordinator coordinator: UIViewControllerTransitionCoordinator
|
||||||
) {
|
) {
|
||||||
delegate?.willExitFullscreen()
|
delegate?.willExitFullscreen()
|
||||||
|
|
||||||
coordinator.animate(alongsideTransition: nil) { [weak self] _ in
|
coordinator.animate(alongsideTransition: nil) { [weak self] context in
|
||||||
guard let self = self else { return }
|
guard let self = self else { return }
|
||||||
|
|
||||||
|
if context.isCancelled {
|
||||||
|
self.delegate?.willEnterFullscreen()
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
self.delegate?.onFullscreenChange(false)
|
self.delegate?.onFullscreenChange(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -135,9 +142,16 @@ class VideoComponentViewObserver: NSObject, AVPlayerViewControllerDelegate {
|
|||||||
willBeginFullScreenPresentationWithAnimationCoordinator coordinator: UIViewControllerTransitionCoordinator
|
willBeginFullScreenPresentationWithAnimationCoordinator coordinator: UIViewControllerTransitionCoordinator
|
||||||
) {
|
) {
|
||||||
delegate?.willEnterFullscreen()
|
delegate?.willEnterFullscreen()
|
||||||
|
|
||||||
coordinator.animate(alongsideTransition: nil) { [weak self] _ in
|
coordinator.animate(alongsideTransition: nil) { [weak self] context in
|
||||||
guard let self = self else { return }
|
guard let self = self else { return }
|
||||||
|
|
||||||
|
if context.isCancelled {
|
||||||
|
self.delegate?.willExitFullscreen()
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
self.delegate?.onFullscreenChange(true)
|
self.delegate?.onFullscreenChange(true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user