Enhance video playback features by adding playTime and initialPosition handling, and update PlayerControls for better focus management

This commit is contained in:
zimplexing
2025-07-07 22:14:56 +08:00
parent 08e24dd748
commit bd22fa2996
8 changed files with 94 additions and 55 deletions

View File

@@ -46,7 +46,7 @@ export const useTVRemoteHandler = ({
}
// Only set a timer to hide controls if they are shown AND no element is focused.
if (showControls && currentFocus === null) {
if (showControls) {
controlsTimer.current = setTimeout(() => {
setShowControls(false);
}, 5000);
@@ -64,9 +64,13 @@ export const useTVRemoteHandler = ({
return;
}
// If controls are hidden, the first interaction will just show them.
// If controls are hidden, 'select' should toggle play/pause immediately
// and other interactions will just show the controls.
if (!showControls) {
if (["up", "down", "left", "right", "select"].includes(event.eventType)) {
if (event.eventType === "select") {
onPlayPause();
setShowControls(true);
} else if (["up", "down", "left", "right"].includes(event.eventType)) {
setShowControls(true);
}
return;