Explorar o código

feat:关闭被带看人语音

jinx %!s(int64=3) %!d(string=hai) anos
pai
achega
c1aa8bf199
Modificáronse 2 ficheiros con 20 adicións e 10 borrados
  1. 15 8
      component/voice/voice.js
  2. 5 2
      socket.js

+ 15 - 8
component/voice/voice.js

@@ -35,11 +35,14 @@ Component({
         return
       }
       console.warn(user.noMute, '---noMute')
-      if (user.noMute) {
-        this.unpublishLocalAudio()
-      } else {
-        this.publishLocalAudio()
+      // if(user.role=='leader'){
+        if (user.noMute) {
+          this.unpublishLocalAudio()
+        } else {
+          this.publishLocalAudio()
+        // }
       }
+      
     }
     // console.log(getApp().globalData.pusher, 'getApp().globalData.pusher')
     // if (getApp().globalData.pusher) {
@@ -102,12 +105,16 @@ Component({
           this.trtcRoomContext.on(EVENT.LOCAL_JOIN, (event) => {
             // 进房成功后发布本地音频流和视频流 
             console.error('进入房间')
+           
             this.successEnter = true
-            if (user.noMute) {
-              this.unpublishLocalAudio()
-            } else {
-              this.publishLocalAudio()
+            if(user.role=='leader'){
+              if (user.noMute) {
+                this.unpublishLocalAudio()
+              } else {
+                this.publishLocalAudio()
+              }
             }
+          
           })
   
           this.trtcRoomContext.on(EVENT.LOCAL_LEAVE, (event) => {

+ 5 - 2
socket.js

@@ -499,7 +499,7 @@ export default {
   },
 
   async startCall(data) {
-    if( this.role =='leader'){
+    // if( this.role =='leader'){
       this.setData({
         shareStatus: 1
       })
@@ -541,7 +541,7 @@ export default {
       // this.socketSendMessage('changeVoiceStatus', {
       //   status: getApp().globalData.voiceProps.noMute ? 0 : 2
       // })
-    }
+    // }
     
   },
 
@@ -564,6 +564,9 @@ export default {
     if (data.roomsPerson.length <= 1) {
       // this.stopCall()
     }
+    this.setData({
+      surplus: this.data.peopleCount - data.roomsPerson.length
+    })
   },
   async newRoom(data) {
     if (data.roomId) return;