liming преди 4 дни
родител
ревизия
9f1d537da0
променени са 1 файла, в които са добавени 2 реда и са изтрити 5 реда
  1. 2 5
      src/stores/modules/webrtcStore.js

+ 2 - 5
src/stores/modules/webrtcStore.js

@@ -115,18 +115,15 @@ export const useWebRTCStore = defineStore("webrtc", {
           event.streams[0].getTracks().forEach((track) => {
             this.remoteStream.addTrack(track);
           });
-          // 绑定音频
-          // this.bindRemoteAudio();
+          
         };
 
         // 监听 ICE 连接状态(关键修复!)
         this.peerConnection.oniceconnectionstatechange = () => {
           const state = this.peerConnection.iceConnectionState;
-          console.log("ICE 连接状态:", state);
-
           if (state === "connected") {
             console.log("✅ P2P 连接成功,可以开始语音通话!");
-            this.bindRemoteAudio();
+            if(this.streamType == "audio") this.bindRemoteAudio();
           } else if (state === "failed") {
             console.error("❌ ICE 连接失败,尝试重启...");
             this.restartICE();