diff --git a/Wasserflug-tvOS/ViewModels/LivestreamViewModel.swift b/Wasserflug-tvOS/ViewModels/LivestreamViewModel.swift index 109ff10..1cd7247 100644 --- a/Wasserflug-tvOS/ViewModels/LivestreamViewModel.swift +++ b/Wasserflug-tvOS/ViewModels/LivestreamViewModel.swift @@ -89,12 +89,11 @@ class LivestreamViewModel: BaseViewModel, ObservableObject { self.state = .failed(LivestreamError.badUrl) return } - if case let .loaded((_, _, oldUrl)) = self.state { - if newUrl != oldUrl { - self.shouldUpdatePlayer = true - } - } + + self.shouldUpdatePlayer = true + self.state = .loaded((creator, cdnResponse, newUrl)) self.startLoadingLiveStatus() + self.loadLiveStatus() } } @@ -149,10 +148,10 @@ class LivestreamViewModel: BaseViewModel, ObservableObject { guard self.liveStatusTimer == nil else { return } - self.loadLiveStatus() self.liveStatusTimer = Timer.scheduledTimer(withTimeInterval: interval, repeats: true, block: { _ in self.loadLiveStatus() }) + self.loadLiveStatus() } private func metadataItem(identifier: AVMetadataIdentifier, value: Any) -> AVMetadataItem { diff --git a/Wasserflug-tvOS/Views/CreatorContentView.swift b/Wasserflug-tvOS/Views/CreatorContentView.swift index cf976fb..ce40ed9 100644 --- a/Wasserflug-tvOS/Views/CreatorContentView.swift +++ b/Wasserflug-tvOS/Views/CreatorContentView.swift @@ -89,6 +89,7 @@ struct CreatorContentView: View { }) .sheet(isPresented: $isShowingLive, onDismiss: { self.isShowingLive = false + self.livestreamViewModel.state = .idle }, content: { LivestreamView(viewModel: self.livestreamViewModel) })