Compare commits

...

2 Commits

Author SHA1 Message Date
Song367
ccd0a8bc34 Merge branch 'dev' of https://gitea.yantootech.com/songjvcheng/WebRtc_QingGan into dev
All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 1m19s
2025-07-30 19:02:31 +08:00
Song367
25ad982b5f ok 2025-07-30 18:58:34 +08:00

View File

@ -621,15 +621,17 @@ class WebRTCChat {
try {
this.logMessage(`开始平滑切换视频流: ${videoFile} (${type})`, 'info');
// 显示加载指示器
// 检查是否已缓存,如果已缓存则不显示加载指示器
const isCached = this.videoStreams.has(videoFile);
if (!isCached) {
this.showVideoLoading();
}
// 确定当前活跃的视频元素和缓冲元素
const currentVideo = this.activeVideoElement === 'main' ? this.recordedVideo : this.recordedVideoBuffer;
const bufferVideo = this.activeVideoElement === 'main' ? this.recordedVideoBuffer : this.recordedVideo;
// 检查是否已缓存
const isCached = this.videoStreams.has(videoFile);
let newStream;
if (isCached) {
@ -674,11 +676,13 @@ class WebRTCChat {
bufferVideo.play().catch(onError);
});
// 隐藏加载指示器
// 只有显示了加载指示器才隐藏
if (!isCached) {
this.hideVideoLoading();
}
// 执行淡入淡出切换
await this.performVideoTransition(currentVideo, bufferVideo);
// await this.performVideoTransition(currentVideo, bufferVideo);
// 更新当前视频流和活跃元素
this.currentVideoStream = newStream;
@ -712,6 +716,7 @@ class WebRTCChat {
} catch (error) {
this.logMessage(`平滑切换视频流失败: ${error.message}`, 'error');
// 确保隐藏加载指示器
this.hideVideoLoading();
// 如果切换失败,尝试回到默认视频