diff --git a/src/app/play/page.tsx b/src/app/play/page.tsx index c026b02..6397e3b 100644 --- a/src/app/play/page.tsx +++ b/src/app/play/page.tsx @@ -196,6 +196,8 @@ function PlayPageClient() { // 长按三倍速相关 const longPressTimeoutRef = useRef(null); const normalPlaybackRateRef = useRef(1); + // 标记长按是否已生效 + const longPressActiveRef = useRef(false); // 同步最新值到 refs useEffect(() => { @@ -1065,6 +1067,7 @@ function PlayPageClient() { if (playerRef.current) { normalPlaybackRateRef.current = playerRef.current.playbackRate || 1; playerRef.current.playbackRate = 3.0; + longPressActiveRef.current = true; // 记录长按已激活 displayShortcutHint('3倍速', 'play'); } }, 300); // 按压 300ms 触发 @@ -1075,8 +1078,10 @@ function PlayPageClient() { clearTimeout(longPressTimeoutRef.current); longPressTimeoutRef.current = null; } - if (playerRef.current) { + // 只有在长按激活过且当前倍速为 3.0 时才恢复,防止误触 + if (playerRef.current && longPressActiveRef.current) { playerRef.current.playbackRate = normalPlaybackRateRef.current || 1; + longPressActiveRef.current = false; } }; @@ -1870,7 +1875,7 @@ const PlaybackRateButton = ({ className='vds-radio-group' aria-label='Custom Options' value={rate.toString()} - onChange={(value) => { + onChange={(value: string) => { const player = playerRef.current; if (!player) { return; @@ -1879,7 +1884,7 @@ const PlaybackRateButton = ({ playerContainerRef.current?.focus(); }} > - {rates.reverse().map((rate) => ( + {[...rates].reverse().map((rate) => ( { xmlns='http://www.w3.org/2000/svg' >