Bring AVPlayer back to tvOS

This commit is contained in:
Arkadiusz Fal
2022-08-20 23:05:40 +02:00
parent 48e616b301
commit ae9b23b9e7
16 changed files with 245 additions and 197 deletions

View File

@@ -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 {