mirror of
https://github.com/yattee/yattee.git
synced 2026-05-12 10:25:02 +00:00
Revert "Fade out tvOS player controls on auto-hide"
This reverts commit a65fbc44ff721a7cb73afd04c41bd44d58bcb034.
This commit is contained in:
@@ -201,37 +201,34 @@ 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,
|
focusedControl: $focusedControl,
|
||||||
focusedControl: $focusedControl,
|
onShowSettings: { showQualitySheet() },
|
||||||
onShowSettings: { showQualitySheet() },
|
onShowQueue: { showQueueSheet() },
|
||||||
onShowQueue: { showQueueSheet() },
|
onShowDetails: { showDetailsPanel(tab: .info) },
|
||||||
onShowDetails: { showDetailsPanel(tab: .info) },
|
onShowComments: { showDetailsPanel(tab: .comments) },
|
||||||
onShowComments: { showDetailsPanel(tab: .comments) },
|
onShowDebug: { showDebugOverlay() },
|
||||||
onShowDebug: { showDebugOverlay() },
|
onClose: { closeVideo() },
|
||||||
onClose: { closeVideo() },
|
onScrubbingChanged: { scrubbing in
|
||||||
onScrubbingChanged: { scrubbing in
|
isScrubbing = scrubbing
|
||||||
isScrubbing = scrubbing
|
if scrubbing {
|
||||||
if scrubbing {
|
stopControlsTimer()
|
||||||
stopControlsTimer()
|
} else {
|
||||||
} else {
|
startControlsTimer()
|
||||||
startControlsTimer()
|
}
|
||||||
}
|
},
|
||||||
},
|
remoteSeekTime: scrubberRemoteSeekTime,
|
||||||
remoteSeekTime: scrubberRemoteSeekTime,
|
onRemoteSeek: { forward in
|
||||||
onRemoteSeek: { forward in
|
triggerScrubberRemoteSeek(forward: forward)
|
||||||
triggerScrubberRemoteSeek(forward: forward)
|
},
|
||||||
},
|
cancelScrubTrigger: cancelScrubTrigger
|
||||||
cancelScrubTrigger: cancelScrubTrigger
|
)
|
||||||
)
|
.transition(.opacity.animation(.easeInOut(duration: 0.25)))
|
||||||
.opacity(shouldShowControls ? 1 : 0)
|
}
|
||||||
.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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user