gemercheung vor 2 Jahren
Ursprung
Commit
6b28c93836

+ 8 - 6
miniprogram/components/voice-v4/voice.js

@@ -108,13 +108,15 @@ Component({
         if (this.trtcRoomContext) {
           this.trtcRoomContext.on(EVENT.LOCAL_JOIN, (event) => {
             // 进房成功后发布本地音频流和视频流 
-            console.error('进入房间')
+            console.error('进入房间', user.noMute)
             this.successEnter = true
-            if (user.noMute) {
-              this.unpublishLocalAudio()
-            } else {
-              this.publishLocalAudio()
-            }
+            // 进入默认麦克风
+            this.unpublishLocalAudio()
+            // if (user.noMute) {
+            //   this.unpublishLocalAudio()
+            // } else {
+            //   this.publishLocalAudio()
+            // }
           })
 
           this.trtcRoomContext.on(EVENT.LOCAL_LEAVE, (event) => {

+ 22 - 4
miniprogram/pages/room/room.ts

@@ -97,6 +97,25 @@ Page({
   },
 
   webViewParams() {
+    const regex = /^[\u4E00-\u9FA5A-Za-z0-9]+$/
+    '⎕'
+    // if (!regex.test(this.data.userInfo.nickName)) {
+    //   this.setData({
+    //     'userInfo.nickName': 'user_' + this.data.userInfo.wxUserId
+    //   })
+    // }
+
+    const filterNickname = (value: string) => {
+      var reg = /\\|\/|\?|\?|\*|\"|\“|\”|\'|\‘|\’|\<|\>|\{|\}|\[|\]|\【|\】|\:|\:|\、|\^|\$|\#|\&|\%|\!|\~|\`|\|/g;
+      var temp = value.replace(reg, "◻");
+      this.setData({
+        'userInfo.nickName': encodeURIComponent(temp)
+      })
+      console.log('filterNickname',temp);
+
+    }
+    filterNickname(this.data.userInfo.nickName);
+
     const params: SocketParams = {
       vruserId: `${this.data.userInfo.wxUserId}`,
       roomId: `${this.data.roomId}`,
@@ -202,10 +221,6 @@ Page({
     if (!this.audioManger.ring) {
       this.audioManger.start()
     }
-
-    setTimeout(() => {
-      this.audioManger.changeMute(true)
-    }, 2000)
   },
   /**
    * 生命周期函数--监听页面初次渲染完成
@@ -297,8 +312,11 @@ Page({
   },
   handleSocketSignal(data) {
     debugger
+
+
   },
   handleActionMuted(userId: string | undefined, muted: boolean | undefined) {
+    console.error('handleActionMuted');
     if (userId && typeof muted !== "undefined") {
       const f_userId = userId.replace('user_', '')
       const app = getApp<IAppOption>();

+ 1 - 1
project.private.config.json

@@ -5,5 +5,5 @@
     "compileHotReLoad": false,
     "bigPackageSizeSupport": true
   },
-  "libVersion": "2.30.1"
+  "libVersion": "2.25.3"
 }