修复问题6
This commit is contained in:
@@ -94,6 +94,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
let managedSubtitleTracks = [];
|
||||
let selectedSubtitleTrackId = 'off';
|
||||
let pendingAutoPlayAfterDownload = false;
|
||||
let lastPolledProgressSignature = '';
|
||||
|
||||
if (videoPlayer) {
|
||||
videoPlayer.controls = false;
|
||||
@@ -1377,10 +1378,22 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
const pollProgress = async () => {
|
||||
if (!currentVideoKey) return;
|
||||
try {
|
||||
const res = await fetch(`/api/progress?key=${encodeURIComponent(currentVideoKey)}`);
|
||||
const res = await fetch(`/api/progress?key=${encodeURIComponent(currentVideoKey)}&_=${Date.now()}`, {
|
||||
cache: 'no-store'
|
||||
});
|
||||
if (!res.ok) return;
|
||||
const data = await res.json();
|
||||
if (data?.progress) {
|
||||
const nextSignature = `${data.progress.status}:${typeof data.progress.percent === 'number' ? data.progress.percent : 'na'}`;
|
||||
if (lastPolledProgressSignature !== nextSignature) {
|
||||
lastPolledProgressSignature = nextSignature;
|
||||
console.log('[progress-poll]', {
|
||||
status: data.progress.status,
|
||||
percent: data.progress.percent,
|
||||
downloadedBytes: data.progress.downloadedBytes,
|
||||
totalBytes: data.progress.totalBytes
|
||||
});
|
||||
}
|
||||
handleProgress(data.progress);
|
||||
if (typeof data.progress.duration === 'number' && data.progress.duration > 0) {
|
||||
videoDuration = data.progress.duration;
|
||||
|
||||
Reference in New Issue
Block a user