Compare commits

..

No commits in common. "ccd0a8bc3441b375c53e62c3c3d3247fa9e42dd5" and "78390a37deeccc37d3a6c6a66a2dd0aa7730216b" have entirely different histories.

View File

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