修复问题

This commit is contained in:
CN-JS-HuiBai
2026-04-03 23:13:33 +08:00
parent 2342e1f8a5
commit d0ad5f4683

View File

@@ -439,6 +439,8 @@ document.addEventListener('DOMContentLoaded', () => {
const status = progress.status;
if (status === 'downloading') {
if (transcodingOverlay) transcodingOverlay.classList.remove('hidden');
if (videoPlayer) videoPlayer.classList.add('hidden');
hasDownloadCompleted = false;
showDownloadPhase();
const percent = Math.min(Math.max(Math.round(progress.percent || 0), 0), 100);
@@ -449,6 +451,8 @@ document.addEventListener('DOMContentLoaded', () => {
downloadProgressText.textContent = `${percent}%`;
downloadProgressFill.style.width = `${percent}%`;
} else if (status === 'downloaded') {
if (transcodingOverlay) transcodingOverlay.classList.remove('hidden');
if (videoPlayer) videoPlayer.classList.add('hidden');
hasDownloadCompleted = true;
showDownloadPhase();
updateTranscodeProgressBar(100);
@@ -461,6 +465,8 @@ document.addEventListener('DOMContentLoaded', () => {
showTranscodePhase();
}, 600);
} else if (status === 'transcoding') {
if (transcodingOverlay) transcodingOverlay.classList.remove('hidden');
if (videoPlayer) videoPlayer.classList.add('hidden');
hasDownloadCompleted = true;
showTranscodePhase();
const percent = Math.min(Math.max(Math.round(progress.percent || 0), 0), 100);
@@ -476,6 +482,7 @@ document.addEventListener('DOMContentLoaded', () => {
statTime.textContent = progress.timemark ? `${progress.timemark}` : '';
}
} else if (status === 'finished') {
if (transcodingOverlay) transcodingOverlay.classList.remove('hidden');
hasDownloadCompleted = true;
showTranscodePhase();
updateTranscodeProgressBar(100);
@@ -483,10 +490,12 @@ document.addEventListener('DOMContentLoaded', () => {
transcodeProgressFill.style.width = '100%';
transcodeDetailText.textContent = '转码完成';
} else if (status === 'failed') {
if (transcodingOverlay) transcodingOverlay.classList.remove('hidden');
updateTranscodeProgressBar(progress.percent || 0);
transcodeDetailText.textContent = `失败: ${progress.details || '未知错误'}`;
transcodeProgressFill.style.background = 'linear-gradient(90deg, #dc2626, #b91c1c)';
} else if (status === 'cancelled') {
if (transcodingOverlay) transcodingOverlay.classList.remove('hidden');
updateTranscodeProgressBar(0);
transcodeDetailText.textContent = '已取消';
transcodeProgressFill.style.width = '0%';
@@ -1231,6 +1240,7 @@ document.addEventListener('DOMContentLoaded', () => {
}
stopPolling();
resetPhases();
handleProgress({ status: 'downloading', percent: 0, downloadedBytes: 0, totalBytes: 0 });
seekOffset = 0;
videoDuration = 0;
isStreamActive = false;