feat: restore playbackrate in webkit

This commit is contained in:
shinya
2025-07-30 21:55:17 +08:00
parent f969e203e2
commit 6989d5e952
3 changed files with 15 additions and 2 deletions

View File

@@ -147,6 +147,8 @@ function PlayPageClient() {
const resumeTimeRef = useRef<number | null>(null);
// 上次使用的音量,默认 0.7
const lastVolumeRef = useRef<number>(0.7);
// 上次使用的播放速率,默认 1.0
const lastPlaybackRateRef = useRef<number>(1.0);
// 换源相关状态
const [availableSources, setAvailableSources] = useState<SearchResult[]>([]);
@@ -1354,6 +1356,9 @@ function PlayPageClient() {
artPlayerRef.current.on('video:volumechange', () => {
lastVolumeRef.current = artPlayerRef.current.volume;
});
artPlayerRef.current.on('video:ratechange', () => {
lastPlaybackRateRef.current = artPlayerRef.current.playbackRate;
});
// 监听视频可播放事件,这时恢复播放进度更可靠
artPlayerRef.current.on('video:canplay', () => {
@@ -1379,6 +1384,14 @@ function PlayPageClient() {
) {
artPlayerRef.current.volume = lastVolumeRef.current;
}
if (
Math.abs(
artPlayerRef.current.playbackRate - lastPlaybackRateRef.current
) > 0.01 &&
isWebkit
) {
artPlayerRef.current.playbackRate = lastPlaybackRateRef.current;
}
artPlayerRef.current.notice.show = '';
}, 0);

View File

@@ -2,7 +2,7 @@
'use client';
const CURRENT_VERSION = '20250730101917';
const CURRENT_VERSION = '20250730215517';
// 版本检查结果枚举
export enum UpdateStatus {