Add related videos

This commit is contained in:
Arkadiusz Fal
2021-11-03 00:02:02 +01:00
parent f49453e871
commit f8e6560698
13 changed files with 185 additions and 46 deletions

View File

@@ -32,23 +32,29 @@ final class PlayerViewController: UIViewController {
#if os(tvOS)
playerModel.avPlayerViewController = playerViewController
playerViewController.customInfoViewControllers = [playerQueueInfoViewController]
playerViewController.customInfoViewControllers = [
infoViewController([.related], title: "Related"),
infoViewController([.playingNext, .playedPreviously], title: "Playing Next")
]
#else
embedViewController()
#endif
}
#if os(tvOS)
var playerQueueInfoViewController: UIHostingController<AnyView> {
func infoViewController(
_ sections: [NowPlayingView.ViewSection],
title: String
) -> UIHostingController<AnyView> {
let controller = UIHostingController(rootView:
AnyView(
NowPlayingView(inInfoViewController: true)
NowPlayingView(sections: sections, inInfoViewController: true)
.frame(maxHeight: 600)
.environmentObject(playerModel)
)
)
controller.title = "Playing Next"
controller.title = title
return controller
}