fix(tv): implement remote control seeking on tv interface

This commit is contained in:
Fredrik Burmester
2026-01-16 12:40:37 +01:00
parent 4880392197
commit 8d90fe3a8b
2 changed files with 22 additions and 3 deletions

View File

@@ -114,6 +114,25 @@ export const Controls: FC<Props> = ({
setShowControls(!showControls);
}, [showControls, setShowControls]);
// Long press seek handlers for continuous seeking
const handleSeekForward = useCallback(
(seconds: number) => {
const newPosition = Math.min(max.value, progress.value + seconds * 1000);
progress.value = newPosition;
seek(newPosition);
},
[progress, max, seek],
);
const handleSeekBackward = useCallback(
(seconds: number) => {
const newPosition = Math.max(min.value, progress.value - seconds * 1000);
progress.value = newPosition;
seek(newPosition);
},
[progress, min, seek],
);
// Remote control hook for TV navigation
const {
remoteScrubProgress,
@@ -132,8 +151,8 @@ export const Controls: FC<Props> = ({
togglePlay,
toggleControls,
calculateTrickplayUrl,
handleSeekForward: () => {},
handleSeekBackward: () => {},
handleSeekForward,
handleSeekBackward,
});
// Slider hook

View File

@@ -1,6 +1,6 @@
export const CONTROLS_CONSTANTS = {
TIMEOUT: 4000,
SCRUB_INTERVAL_MS: 10 * 1000, // 10 seconds in ms
SCRUB_INTERVAL_MS: 30 * 1000, // 30 seconds in ms
SCRUB_INTERVAL_TICKS: 10 * 10000000, // 10 seconds in ticks
TILE_WIDTH: 150,
PROGRESS_UNIT_MS: 1000, // 1 second in ms