Skip to content

Commit

Permalink
Fix bugs with livestream viewing
Browse files Browse the repository at this point in the history
  • Loading branch information
Jman012 committed Oct 31, 2022
1 parent 93b31e8 commit d7d94eb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
11 changes: 5 additions & 6 deletions Wasserflug-tvOS/ViewModels/LivestreamViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}

Expand Down Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions Wasserflug-tvOS/Views/CreatorContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ struct CreatorContentView: View {
})
.sheet(isPresented: $isShowingLive, onDismiss: {
self.isShowingLive = false
self.livestreamViewModel.state = .idle
}, content: {
LivestreamView(viewModel: self.livestreamViewModel)
})
Expand Down

0 comments on commit d7d94eb

Please sign in to comment.