Fix stream state

This commit is contained in:
Arkadiusz Fal 2021-10-14 00:10:29 +02:00
parent 2c275d9353
commit a68d89cb6f
5 changed files with 12 additions and 1 deletions

View File

@ -67,6 +67,8 @@ final class PlayerModel: ObservableObject {
func playVideo(_ video: Video) {
if video.live {
self.stream = nil
playHlsUrl(video)
return
}

View File

@ -42,6 +42,7 @@ struct ContentView: View {
.fullScreenCover(isPresented: $player.presentingPlayer) {
VideoPlayerView()
.environmentObject(api)
.environmentObject(instances)
.environmentObject(navigation)
.environmentObject(player)
.environmentObject(subscriptions)
@ -51,6 +52,7 @@ struct ContentView: View {
VideoPlayerView()
.frame(minWidth: 900, minHeight: 800)
.environmentObject(api)
.environmentObject(instances)
.environmentObject(navigation)
.environmentObject(player)
.environmentObject(subscriptions)

View File

@ -79,3 +79,10 @@ struct PlaybackBar: View {
.keyboardShortcut(.cancelAction)
}
}
struct PlaybackBar_Previews: PreviewProvider {
static var previews: some View {
PlaybackBar()
.injectFixtureEnvironmentObjects()
}
}

View File

@ -159,7 +159,6 @@ struct VideoPlayerView: View {
struct VideoPlayerView_Previews: PreviewProvider {
static var previews: some View {
VideoPlayerView()
// .frame(minWidth: 1200, minHeight: 1400)
.injectFixtureEnvironmentObjects()
VideoPlayerView()

View File

@ -18,6 +18,7 @@ struct Player: NSViewControllerRepresentable {
let controller = PlayerViewController()
controller.playerModel = player
player.controller = controller
return controller
}