From 7075e58331aceada155ac17a4e189663e8a169a2 Mon Sep 17 00:00:00 2001 From: songjvcheng Date: Mon, 11 Aug 2025 15:24:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8Cnew=5Fmale=20=E5=88=86=E6=94=AF?= =?UTF-8?q?=E4=B8=80=E6=A0=B7=E4=BF=AE=E6=94=B9=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/index.js | 31 ++++++++++++++++++++----------- src/minimaxi_stream.js | 2 +- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/src/index.js b/src/index.js index d88608e..4a43ae6 100644 --- a/src/index.js +++ b/src/index.js @@ -334,6 +334,8 @@ class WebRTCChat { } // 设置视频流 + this.recordedVideoBuffer.style.zIndex = "1"; + this.recordedVideo.style.zIndex = "2"; this.currentVideoStream = defaultStream; this.recordedVideo.srcObject = defaultStream; this.recordedVideoBuffer.srcObject = this.precreatedStreams.get(this.interactionVideo); @@ -360,7 +362,11 @@ class WebRTCChat { }; checkReady(); }); - + this.avatarContainer.style.display = 'none'; + + // 隐藏等待连接提示 + this.hideConnectionWaiting(); + // 确保视频开始播放 try { await this.recordedVideo.play(); @@ -1117,10 +1123,11 @@ class WebRTCChat { hideConnectionWaiting() { if (this.connectionWaiting) { this.connectionWaiting.classList.remove('show'); - // 等待动画完成后隐藏元素 - setTimeout(() => { - this.connectionWaiting.style.display = 'none'; - }, 300); + this.connectionWaiting.style.display = 'none'; + // // 等待动画完成后隐藏元素 + // setTimeout(() => { + // this.connectionWaiting.style.display = 'none'; + // }, 300); } } @@ -1161,14 +1168,17 @@ class WebRTCChat { this.startButton.disabled = true; this.startButton.style.opacity = '0.5' this.stopButton.disabled = false; + + // 隐藏头像,显示视频 + if (this.videoContainer) { + + this.videoContainer.classList.add('calling'); + } // 显示结束通话按钮 this.stopButton.style.display = 'block'; - // 隐藏头像,显示视频 - if (this.videoContainer) { - this.videoContainer.classList.add('calling'); - } + this.updateAudioStatus('已连接', 'connected'); this.logMessage('音频通话已开始', 'success'); @@ -1186,8 +1196,7 @@ class WebRTCChat { // 开始播放当前场景的默认视频 // await this.precreateImportantVideos(); - // 隐藏等待连接提示 - this.hideConnectionWaiting(); + } catch (error) { this.logMessage(`开始通话失败: ${error.message}`, 'error'); diff --git a/src/minimaxi_stream.js b/src/minimaxi_stream.js index 3b8a5ce..f50f201 100644 --- a/src/minimaxi_stream.js +++ b/src/minimaxi_stream.js @@ -68,7 +68,7 @@ async function processAudioQueue() { const sayName = '8-4-sh' const targetVideo = window.webrtcApp.interactionVideo // 如果是第一个音频片段,触发视频切换 - if (isFirstChunk && sayName != window.webrtcApp.currentVideoTag && window.webrtcApp && window.webrtcApp.switchVideoStream) { + if (sayName != window.webrtcApp.currentVideoTag && window.webrtcApp && window.webrtcApp.switchVideoStream) { try { console.log('--------------触发视频切换:', sayName); window.webrtcApp.switchVideoStream(targetVideo, 'audio', '8-4-sh');