Browse Source

优化禁音效果

caner 3 years ago
parent
commit
c9b4bf09f6
1 changed files with 3 additions and 4 deletions
  1. 3 4
      src/App.vue

+ 3 - 4
src/App.vue

@@ -95,10 +95,9 @@ export default {
             console.log("track", evt);
             console.log("track", evt);
             this.remoteVideo = document.getElementById("v2");
             this.remoteVideo = document.getElementById("v2");
             this.remoteVideo.srcObject = evt.streams[0];
             this.remoteVideo.srcObject = evt.streams[0];
-            if (evt.track.kind === 'audio') this.remoteAudioTrak = evt.streams[0]
           };
           };
 
 
-          // listen changestate
+          // listen changestate·
           this.Peer.oniceconnectionstatechange = async () => {
           this.Peer.oniceconnectionstatechange = async () => {
             const state = this.Peer.iceConnectionState;
             const state = this.Peer.iceConnectionState;
             console.log("ICE状态", state);
             console.log("ICE状态", state);
@@ -257,10 +256,10 @@ export default {
     // 静音
     // 静音
     mutedState(v) {
     mutedState(v) {
       if (v) {
       if (v) {
-        this.num++
-        const state = this.num % 2 ? false : true
+        const state = !!(this.num % 2 )
         this.muted = state
         this.muted = state
         if (this.socket && this.socket.connected) this.socket.emit("msg", { type: "contrlAudio", contrlAudio: state });
         if (this.socket && this.socket.connected) this.socket.emit("msg", { type: "contrlAudio", contrlAudio: state });
+        this.num++
       }
       }
     },
     },
     // 鸣笛
     // 鸣笛