瀏覽代碼

feat:兼容50人,关闭被带看人语音

jinx 3 年之前
父節點
當前提交
454fe782bf
共有 1 個文件被更改,包括 42 次插入39 次删除
  1. 42 39
      socket.js

+ 42 - 39
socket.js

@@ -5,7 +5,7 @@ const util = require('/utils/util.js');
 const UNLOGIN = 'NO_LOGIN'
 const btoa = require('./utils/btoa')
 
-const manyCount = 30
+const manyCount = 50
 
 import remote from './config.js'
 var app = getApp();
@@ -344,7 +344,7 @@ export default {
      
       if (!enableTalk && !noMute) {
         if (this.role !== 'leader') {
-          this.mic()
+          // this.mic()
         }
        
       }
@@ -499,47 +499,50 @@ export default {
   },
 
   async startCall(data) {
-    this.setData({
-      shareStatus: 1
-    })
-    if (!data) return;
-
-    this.setData({
-      surplus: this.data.peopleCount - data.roomsPerson.length
-    })
-    if (!this.isAuthorizeRecord) {
-      const voiceStatus = Number(await this.authorizeRecord())
-      this.isAuthorizeRecord = true
-
-      // getApp().setVoiceProps({
-      //   noMute: !voiceStatus
-      // })
-
-      // console.log(getApp().globalData.voiceProps.noMute)
+    if( this.role =='leader'){
+      this.setData({
+        shareStatus: 1
+      })
+      if (!data) return;
+  
+      this.setData({
+        surplus: this.data.peopleCount - data.roomsPerson.length
+      })
+      if (!this.isAuthorizeRecord) {
+        const voiceStatus = Number(await this.authorizeRecord())
+        this.isAuthorizeRecord = true
+  
+        // getApp().setVoiceProps({
+        //   noMute: !voiceStatus
+        // })
+  
+        // console.log(getApp().globalData.voiceProps.noMute)
+        // this.socketSendMessage('changeVoiceStatus', {
+        //   status: getApp().globalData.voiceProps.noMute ? 0 : 2
+        // })
+        // this.data.socketOptions.voiceStatus = 1
+        // this.socketSendMessage('changeVoiceStatus', {status: noMute ? 0 : 2})
+      }
+  
+      const socketOptions = this.data.socketOptions
+      getApp().globalData.roomId = socketOptions.roomId
+      const user = data.roomsPerson.find(user => user.userId == socketOptions.userId)
+      if (!user) {
+        return
+      }
+      if (data.roomsPerson.length <= 1) {
+        return
+      }
+      user.noMute = getApp().globalData.voiceProps.noMute
+      getApp().setVoiceProps({
+        ...user,
+        action: 'startCall'
+      })
       // this.socketSendMessage('changeVoiceStatus', {
       //   status: getApp().globalData.voiceProps.noMute ? 0 : 2
       // })
-      // this.data.socketOptions.voiceStatus = 1
-      // this.socketSendMessage('changeVoiceStatus', {status: noMute ? 0 : 2})
-    }
-
-    const socketOptions = this.data.socketOptions
-    getApp().globalData.roomId = socketOptions.roomId
-    const user = data.roomsPerson.find(user => user.userId == socketOptions.userId)
-    if (!user) {
-      return
     }
-    if (data.roomsPerson.length <= 1) {
-      return
-    }
-    user.noMute = getApp().globalData.voiceProps.noMute
-    getApp().setVoiceProps({
-      ...user,
-      action: 'startCall'
-    })
-    // this.socketSendMessage('changeVoiceStatus', {
-    //   status: getApp().globalData.voiceProps.noMute ? 0 : 2
-    // })
+    
   },
 
   stopCall() {