feat: add rewind and fast forward

This commit is contained in:
shinya
2025-07-01 23:08:07 +08:00
parent b732e9a3d4
commit bb2b37a078

View File

@@ -1355,26 +1355,55 @@ function PlayPageClient() {
muteButton: null, // 隐藏静音按钮
volumeSlider: null, // 隐藏音量条
airPlayButton: null, // 隐藏默认 AirPlay 按钮
beforeCurrentTime:
totalEpisodes > 1 ? (
// 下一集按钮放在时间显示前
beforeCurrentTime: (
<>
{/* 快进 10 秒按钮 - 移动端隐藏 */}
<button
className='vds-button mr-2'
onClick={handleNextEpisode}
aria-label='Next Episode'
className='vds-button hidden md:inline-flex mr-2'
onClick={() => {
if (playerRef.current) {
const p = playerRef.current;
const newTime = Math.min(
(p.currentTime || 0) + 10,
p.duration || 0
);
p.currentTime = newTime;
}
}}
aria-label='Fast Forward 10 Seconds'
>
<svg
className='vds-icon'
viewBox='0 0 32 32'
xmlns='http://www.w3.org/2000/svg'
>
<path
d='M6 24l12-8L6 8v16zM22 8v16h3V8h-3z'
fill='currentColor'
/>
{/* 双三角快进图标 */}
<path d='M6 24l10-8L6 8v16z' fill='currentColor' />
<path d='M18 24l10-8-10-8v16z' fill='currentColor' />
</svg>
</button>
) : null,
{totalEpisodes > 1 && (
// 下一集按钮放在时间显示前
<button
className='vds-button mr-2'
onClick={handleNextEpisode}
aria-label='Next Episode'
>
<svg
className='vds-icon'
viewBox='0 0 32 32'
xmlns='http://www.w3.org/2000/svg'
>
<path
d='M6 24l12-8L6 8v16zM22 8v16h3V8h-3z'
fill='currentColor'
/>
</svg>
</button>
)}
</>
),
beforeFullscreenButton: (
<>
<button
@@ -1400,6 +1429,30 @@ function PlayPageClient() {
</AirPlayButton>
</>
),
// 快退 10 秒按钮(移动端隐藏)
beforePlayButton: (
<button
className='vds-button hidden md:inline-flex mr-2'
onClick={() => {
if (playerRef.current) {
const p = playerRef.current;
const newTime = Math.max(0, (p.currentTime || 0) - 10);
p.currentTime = newTime;
}
}}
aria-label='Rewind 10 Seconds'
>
<svg
className='vds-icon'
viewBox='0 0 32 32'
xmlns='http://www.w3.org/2000/svg'
>
{/* 双三角快退图标 */}
<path d='M26 24l-10-8 10-8v16z' fill='currentColor' />
<path d='M14 24l-10-8 10-8v16z' fill='currentColor' />
</svg>
</button>
),
}}
/>