mirror of
https://github.com/yattee/yattee.git
synced 2024-12-22 21:43:41 +00:00
Fix updating now playing info with mpv on tvOS
Other minor tvOS fixes
This commit is contained in:
parent
945dbfe00b
commit
d5f8ad4eec
@ -505,16 +505,7 @@ final class PlayerModel: ObservableObject {
|
||||
self.backend.setNeedsDrawing(self.presentingPlayer)
|
||||
}
|
||||
|
||||
#if os(tvOS)
|
||||
if presentingPlayer {
|
||||
controls.show()
|
||||
Delay.by(1) { [weak self] in
|
||||
self?.controls.hide()
|
||||
}
|
||||
}
|
||||
#else
|
||||
controls.hide()
|
||||
#endif
|
||||
|
||||
#if !os(macOS)
|
||||
UIApplication.shared.isIdleTimerDisabled = presentingPlayer
|
||||
@ -883,7 +874,9 @@ final class PlayerModel: ObservableObject {
|
||||
}
|
||||
|
||||
func updateNowPlayingInfo() {
|
||||
#if !os(tvOS)
|
||||
#if os(tvOS)
|
||||
guard activeBackend == .mpv else { return }
|
||||
#endif
|
||||
guard let video = currentItem?.video else {
|
||||
MPNowPlayingInfoCenter.default().nowPlayingInfo = .none
|
||||
return
|
||||
@ -914,7 +907,6 @@ final class PlayerModel: ObservableObject {
|
||||
}
|
||||
|
||||
MPNowPlayingInfoCenter.default().nowPlayingInfo = nowPlayingInfo
|
||||
#endif
|
||||
}
|
||||
|
||||
func updateCurrentArtwork() {
|
||||
|
@ -34,6 +34,8 @@ struct PlayerBackendView: View {
|
||||
.padding(.top, controlsTopPadding)
|
||||
.padding(.bottom, controlsBottomPadding)
|
||||
#endif
|
||||
#else
|
||||
hiddenControlsButton
|
||||
#endif
|
||||
}
|
||||
#if os(iOS)
|
||||
@ -70,6 +72,22 @@ struct PlayerBackendView: View {
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if os(tvOS)
|
||||
private var hiddenControlsButton: some View {
|
||||
VStack {
|
||||
Button {
|
||||
player.controls.show()
|
||||
} label: {
|
||||
EmptyView()
|
||||
}
|
||||
.offset(y: -100)
|
||||
.buttonStyle(.plain)
|
||||
.background(Color.clear)
|
||||
.foregroundColor(.clear)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
struct PlayerBackendView_Previews: PreviewProvider {
|
||||
|
Loading…
Reference in New Issue
Block a user