mirror of
https://github.com/jellyfin/Swiftfin.git
synced 2025-02-24 09:12:19 +00:00
route to video player from liveTv
This commit is contained in:
parent
4e8a419dbc
commit
bcc81213ad
@ -25,9 +25,9 @@ final class LiveTVChannelsCoordinator: NavigationCoordinatable {
|
||||
NavigationViewCoordinator(ItemCoordinator(item: item))
|
||||
}
|
||||
|
||||
func makeVideoPlayer(item: BaseItemDto) -> NavigationViewCoordinator<EmptyViewCoordinator> {
|
||||
// NavigationViewCoordinator(VideoPlayerCoordinator(item: item))
|
||||
NavigationViewCoordinator(EmptyViewCoordinator())
|
||||
func makeVideoPlayer(viewModel: VideoPlayerViewModel) -> NavigationViewCoordinator<VideoPlayerCoordinator> {
|
||||
NavigationViewCoordinator(VideoPlayerCoordinator(viewModel: viewModel))
|
||||
// NavigationViewCoordinator(EmptyViewCoordinator())
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
|
@ -189,6 +189,16 @@ final class LiveTVChannelsViewModel: ViewModel {
|
||||
func stopScheduleCheckTimer() {
|
||||
timer?.invalidate()
|
||||
}
|
||||
|
||||
func fetchVideoPlayerViewModel(item: BaseItemDto, completion: @escaping (VideoPlayerViewModel)->Void) {
|
||||
item.createVideoPlayerViewModel()
|
||||
.sink { completion in
|
||||
self.handleAPIRequestError(completion: completion)
|
||||
} receiveValue: { videoPlayerViewModel in
|
||||
completion(videoPlayerViewModel)
|
||||
}
|
||||
.store(in: &self.cancellables)
|
||||
}
|
||||
}
|
||||
|
||||
extension Array {
|
||||
|
@ -55,7 +55,9 @@ struct LiveTVChannelsView: View {
|
||||
let channel = item.channel
|
||||
if channel.type != "Folder" {
|
||||
Button {
|
||||
self.router.route(to: \.videoPlayer, channel)
|
||||
self.viewModel.fetchVideoPlayerViewModel(item: channel) { playerViewModel in
|
||||
self.router.route(to: \.videoPlayer, playerViewModel)
|
||||
}
|
||||
} label: {
|
||||
LiveTVChannelItemElement(channel: channel,
|
||||
program: item.program,
|
||||
|
Loading…
x
Reference in New Issue
Block a user