This commit is contained in:
2025-08-21 11:08:47 +08:00
parent 3f2eb61c09
commit 7730d20b4e
3 changed files with 120 additions and 6 deletions

View File

@@ -48,7 +48,8 @@
}
.video-player {
max-width: 100%;
max-height: 600px;
max-height: 800px; /* 增加最大高度 */
width: 100%; /* 宽度充满容器 */
border-radius: 6px;
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
display: none;
@@ -186,12 +187,51 @@
// 视频生成完成
loading.style.display = 'none';
progress.style.width = '100%';
progressText.textContent = '生成完成';
progressText.textContent = '生成完成正在保存到OBS...';
// 设置视频源
videoPlayer.src = statusInfo.video_url;
videoPlayer.style.display = 'block';
downloadBtn.style.display = 'inline-block';
// 调用接口将视频保存到OBS
fetch('/api/jimeng/upload_url_to_obs', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
url: statusInfo.video_url,
object_key_prefix: 'jimeng_videos/'
})
})
.then(response => {
if (!response.ok) {
throw new Error('保存到OBS失败');
}
return response.json();
})
.then(obsData => {
if (obsData.code === 200) {
// 获取OBS下载URL
const obsVideoUrl = obsData.data.obs_url;
progressText.textContent = '已保存到OBS';
// 设置视频源为OBS URL
videoPlayer.src = obsVideoUrl;
videoPlayer.style.display = 'block';
downloadBtn.style.display = 'inline-block';
} else {
progressText.textContent = '保存到OBS失败: ' + obsData.message;
// 仍然使用原始URL播放
videoPlayer.src = statusInfo.video_url;
videoPlayer.style.display = 'block';
downloadBtn.style.display = 'inline-block';
}
})
.catch(error => {
console.error('保存到OBS时出错:', error);
progressText.textContent = '保存到OBS出错: ' + error.message;
// 仍然使用原始URL播放
videoPlayer.src = statusInfo.video_url;
videoPlayer.style.display = 'block';
downloadBtn.style.display = 'inline-block';
});
} else if (statusInfo.status === 'failed') {
// 视频生成失败
loading.textContent = '视频生成失败: ' + statusInfo.error_msg;