[tvOS][QOL] Supports back button click when in the native player. (#947)

This commit is contained in:
Eric Lee 2024-01-15 21:41:06 -08:00 committed by GitHub
parent 9434a08a14
commit 3b59bed413
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 10 deletions

View File

@ -46,18 +46,14 @@ final class VideoPlayerCoordinator: NavigationCoordinatable {
} }
#else #else
PreferenceUIHostingControllerView {
Group {
if Defaults[.VideoPlayer.videoPlayerType] == .swiftfin { if Defaults[.VideoPlayer.videoPlayerType] == .swiftfin {
PreferenceUIHostingControllerView {
VideoPlayer(manager: self.videoPlayerManager) VideoPlayer(manager: self.videoPlayerManager)
}
.ignoresSafeArea()
} else { } else {
NativeVideoPlayer(manager: self.videoPlayerManager) NativeVideoPlayer(manager: self.videoPlayerManager)
} }
}
}
.ignoresSafeArea()
#endif #endif
} }
} }

View File

@ -57,6 +57,8 @@ struct NativeVideoPlayerView: UIViewControllerRepresentable {
func updateUIViewController(_ uiViewController: UINativeVideoPlayerViewController, context: Context) {} func updateUIViewController(_ uiViewController: UINativeVideoPlayerViewController, context: Context) {}
} }
// TODO: Refactor such that this does not subclass AVPlayerViewController. Subclassing is not
// supported according to the apple docs.
class UINativeVideoPlayerViewController: AVPlayerViewController { class UINativeVideoPlayerViewController: AVPlayerViewController {
let videoPlayerManager: VideoPlayerManager let videoPlayerManager: VideoPlayerManager