mirror of
https://github.com/yattee/yattee.git
synced 2025-08-09 20:24:06 +00:00
Bring AVPlayer back to tvOS
This commit is contained in:
@@ -58,23 +58,15 @@ struct ControlsOverlay: View {
|
||||
#endif
|
||||
}
|
||||
|
||||
#if os(tvOS)
|
||||
let streamAndPlayerHeaderText = "Stream"
|
||||
#else
|
||||
let streamAndPlayerHeaderText = "Stream & Player"
|
||||
#endif
|
||||
|
||||
Section(header: controlsHeader(streamAndPlayerHeaderText)) {
|
||||
Section(header: controlsHeader("Stream & Player")) {
|
||||
qualityButton
|
||||
#if os(tvOS)
|
||||
.focused($focusedField, equals: .stream)
|
||||
#endif
|
||||
|
||||
#if !os(tvOS)
|
||||
HStack {
|
||||
backendButtons
|
||||
}
|
||||
#endif
|
||||
HStack(spacing: 8) {
|
||||
backendButtons
|
||||
}
|
||||
}
|
||||
|
||||
if player.activeBackend == .mpv,
|
||||
@@ -129,11 +121,13 @@ struct ControlsOverlay: View {
|
||||
private var backendButtons: some View {
|
||||
ForEach(PlayerBackendType.allCases, id: \.self) { backend in
|
||||
backendButton(backend)
|
||||
#if !os(tvOS)
|
||||
.frame(height: 40)
|
||||
#endif
|
||||
#if os(iOS)
|
||||
.frame(maxWidth: 115)
|
||||
.modifier(ControlBackgroundModifier())
|
||||
.clipShape(RoundedRectangle(cornerRadius: 4))
|
||||
.frame(maxWidth: 115)
|
||||
.modifier(ControlBackgroundModifier())
|
||||
.clipShape(RoundedRectangle(cornerRadius: 4))
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -150,9 +144,6 @@ struct ControlsOverlay: View {
|
||||
}
|
||||
#if os(macOS)
|
||||
.buttonStyle(.bordered)
|
||||
#elseif os(tvOS)
|
||||
.modifier(ControlBackgroundModifier())
|
||||
.clipShape(RoundedRectangle(cornerRadius: 4))
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@@ -89,14 +89,15 @@ struct PlayerControls: View {
|
||||
}
|
||||
.frame(maxHeight: .infinity)
|
||||
}
|
||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||
#if os(tvOS)
|
||||
.onChange(of: model.presentingControls) { newValue in
|
||||
if newValue { focusedField = .play }
|
||||
}
|
||||
.onChange(of: focusedField) { _ in model.resetTimer() }
|
||||
.onChange(of: model.presentingControls) { newValue in
|
||||
if newValue { focusedField = .play }
|
||||
}
|
||||
.onChange(of: focusedField) { _ in model.resetTimer() }
|
||||
#else
|
||||
.background(PlayerGestures())
|
||||
.background(controlsBackground)
|
||||
.background(PlayerGestures())
|
||||
.background(controlsBackground)
|
||||
#endif
|
||||
|
||||
if model.presentingDetailsOverlay {
|
||||
@@ -176,6 +177,7 @@ struct PlayerControls: View {
|
||||
}
|
||||
.retryOnAppear(true)
|
||||
.indicator(.activity)
|
||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -273,7 +275,6 @@ struct PlayerControls: View {
|
||||
|
||||
private var musicModeButton: some View {
|
||||
button("Music Mode", systemImage: "music.note", background: false, active: player.musicMode, action: player.toggleMusicMode)
|
||||
.disabled(player.activeBackend == .appleAVPlayer)
|
||||
}
|
||||
|
||||
private var pipButton: some View {
|
||||
|
Reference in New Issue
Block a user