Revert "Fade out tvOS player controls on auto-hide"

This reverts commit a65fbc44ff721a7cb73afd04c41bd44d58bcb034.
This commit is contained in:
Arkadiusz Fal
2026-04-15 19:39:06 +02:00
parent eb697b7bbc
commit 944f849929

View File

@@ -201,9 +201,8 @@ struct TVPlayerView: View {
// Video layer // Video layer
videoLayer videoLayer
// Controls overlay always in tree, toggled via opacity so the fade-out // Controls overlay
// isn't skipped by tvOS's focus engine forcibly tearing down a focused if controlsVisible && !isDetailsPanelVisible && !isDebugOverlayVisible {
// subview when the conditional flips to false.
TVPlayerControlsView( TVPlayerControlsView(
playerState: playerState, playerState: playerState,
playerService: playerService, playerService: playerService,
@@ -228,10 +227,8 @@ struct TVPlayerView: View {
}, },
cancelScrubTrigger: cancelScrubTrigger cancelScrubTrigger: cancelScrubTrigger
) )
.opacity(shouldShowControls ? 1 : 0) .transition(.opacity.animation(.easeInOut(duration: 0.25)))
.allowsHitTesting(shouldShowControls) }
.disabled(!shouldShowControls)
.animation(.easeInOut(duration: 0.25), value: shouldShowControls)
// Swipe-up details panel // Swipe-up details panel
if isDetailsPanelVisible { if isDetailsPanelVisible {
@@ -385,13 +382,6 @@ struct TVPlayerView: View {
} }
} }
// MARK: - Derived State
/// Whether the primary controls overlay should be visible right now.
private var shouldShowControls: Bool {
controlsVisible && !isDetailsPanelVisible && !isDebugOverlayVisible
}
// MARK: - Controls Timer // MARK: - Controls Timer
private func startControlsTimer() { private func startControlsTimer() {
@@ -402,8 +392,9 @@ struct TVPlayerView: View {
controlsHideTimer = Timer.scheduledTimer(withTimeInterval: 4.0, repeats: false) { _ in controlsHideTimer = Timer.scheduledTimer(withTimeInterval: 4.0, repeats: false) { _ in
Task { @MainActor in Task { @MainActor in
withAnimation(.easeOut(duration: 0.2)) { withAnimation(.easeOut(duration: 0.3)) {
controlsVisible = false controlsVisible = false
focusedControl = .background
} }
} }
} }
@@ -671,8 +662,9 @@ struct TVPlayerView: View {
private func hideControls() { private func hideControls() {
stopControlsTimer() stopControlsTimer()
withAnimation(.easeOut(duration: 0.2)) { withAnimation(.easeOut(duration: 0.25)) {
controlsVisible = false controlsVisible = false
focusedControl = .background
} }
} }