enforce web player seek by seconds when less than 1 (#1993)

This commit is contained in:
jeffvli
2026-05-01 21:12:20 -07:00
parent bc7ef0624b
commit 3b2aab74ac
2 changed files with 16 additions and 4 deletions
@@ -140,9 +140,15 @@ export const WebPlayerEngine = (props: WebPlayerEngineProps) => {
}; };
}, },
seekTo(seekTo: number) { seekTo(seekTo: number) {
let type: 'fraction' | 'seconds' | undefined = undefined;
if (seekTo < 1) {
type = 'seconds';
}
playerNum === 1 playerNum === 1
? player1Ref.current?.seekTo(seekTo) ? player1Ref.current?.seekTo(seekTo, type)
: player2Ref.current?.seekTo(seekTo); : player2Ref.current?.seekTo(seekTo, type);
}, },
setVolume(volume: number) { setVolume(volume: number) {
setInternalVolume1(volume / 100 || 0); setInternalVolume1(volume / 100 || 0);
@@ -240,10 +240,16 @@ export function WebPlayer() {
} }
} }
let type: 'fraction' | 'seconds' | undefined = undefined;
if (timestamp < 1) {
type = 'seconds';
}
if (num === 1) { if (num === 1) {
playerRef.current?.player1()?.ref?.seekTo(timestamp); playerRef.current?.player1()?.ref?.seekTo(timestamp, type);
} else { } else {
playerRef.current?.player2()?.ref?.seekTo(timestamp); playerRef.current?.player2()?.ref?.seekTo(timestamp, type);
} }
}, },
onPlayerStatus: async (properties) => { onPlayerStatus: async (properties) => {