mirror of
https://github.com/MoonTechLab/LunaTV.git
synced 2026-05-22 22:57:35 +08:00
feat: add rewind and fast forward
This commit is contained in:
@@ -1355,26 +1355,55 @@ function PlayPageClient() {
|
|||||||
muteButton: null, // 隐藏静音按钮
|
muteButton: null, // 隐藏静音按钮
|
||||||
volumeSlider: null, // 隐藏音量条
|
volumeSlider: null, // 隐藏音量条
|
||||||
airPlayButton: null, // 隐藏默认 AirPlay 按钮
|
airPlayButton: null, // 隐藏默认 AirPlay 按钮
|
||||||
beforeCurrentTime:
|
beforeCurrentTime: (
|
||||||
totalEpisodes > 1 ? (
|
<>
|
||||||
// 下一集按钮放在时间显示前
|
{/* 快进 10 秒按钮 - 移动端隐藏 */}
|
||||||
<button
|
<button
|
||||||
className='vds-button mr-2'
|
className='vds-button hidden md:inline-flex mr-2'
|
||||||
onClick={handleNextEpisode}
|
onClick={() => {
|
||||||
aria-label='Next Episode'
|
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
|
<svg
|
||||||
className='vds-icon'
|
className='vds-icon'
|
||||||
viewBox='0 0 32 32'
|
viewBox='0 0 32 32'
|
||||||
xmlns='http://www.w3.org/2000/svg'
|
xmlns='http://www.w3.org/2000/svg'
|
||||||
>
|
>
|
||||||
<path
|
{/* 双三角快进图标 */}
|
||||||
d='M6 24l12-8L6 8v16zM22 8v16h3V8h-3z'
|
<path d='M6 24l10-8L6 8v16z' fill='currentColor' />
|
||||||
fill='currentColor'
|
<path d='M18 24l10-8-10-8v16z' fill='currentColor' />
|
||||||
/>
|
|
||||||
</svg>
|
</svg>
|
||||||
</button>
|
</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: (
|
beforeFullscreenButton: (
|
||||||
<>
|
<>
|
||||||
<button
|
<button
|
||||||
@@ -1400,6 +1429,30 @@ function PlayPageClient() {
|
|||||||
</AirPlayButton>
|
</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>
|
||||||
|
),
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user