Skip to content

Commit

Permalink
[tvOS][QOL] Supports back button click when in the native player. (#947)
Browse files Browse the repository at this point in the history
  • Loading branch information
nokeeo authored Jan 16, 2024
1 parent 9434a08 commit 3b59bed
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
16 changes: 6 additions & 10 deletions Shared/Coordinators/VideoPlayerCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,14 @@ final class VideoPlayerCoordinator: NavigationCoordinatable {
}

#else

PreferenceUIHostingControllerView {
Group {
if Defaults[.VideoPlayer.videoPlayerType] == .swiftfin {
VideoPlayer(manager: self.videoPlayerManager)
} else {
NativeVideoPlayer(manager: self.videoPlayerManager)
}
if Defaults[.VideoPlayer.videoPlayerType] == .swiftfin {
PreferenceUIHostingControllerView {
VideoPlayer(manager: self.videoPlayerManager)
}
.ignoresSafeArea()
} else {
NativeVideoPlayer(manager: self.videoPlayerManager)
}
.ignoresSafeArea()

#endif
}
}
2 changes: 2 additions & 0 deletions Swiftfin tvOS/Views/VideoPlayer/NativeVideoPlayer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ struct NativeVideoPlayerView: UIViewControllerRepresentable {
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 {

let videoPlayerManager: VideoPlayerManager
Expand Down

0 comments on commit 3b59bed

Please sign in to comment.