liuyu 5 tahun lalu
induk
melakukan
58f702c26b
1 mengubah file dengan 25 tambahan dan 7 penghapusan
  1. 25 7
      src/views/live/roomDetail.vue

+ 25 - 7
src/views/live/roomDetail.vue

@@ -8,7 +8,7 @@
         <div :style="{ height: lheight, width: lwidth }" id="look-video-left" class="video-box col-div look-video-left"></div>
         <div id="look-video-right" :style="{ height: rheight, width: rwidth }" class="video-box col-div look-video-right"></div>
       </div>
-      <div id="othediv" class="wrapper" :style="{ transform: transform, height: otheheight, width: vwidth, padding: othepadding, position: 'absolute' }">
+      <div id="othediv" :style="{ transform: transform, height: otheheight, width: vwidth, padding: othepadding, position: 'absolute' }">
         <div id="othe-video-1" :style="{ height: otheheight, width: othewidth }" class="video-box col-div othe-video-left"></div>
         <div id="othe-video-2" :style="{ height: otheheight, width: othewidth }" class="video-box col-div othe-video-left"></div>
         <div id="othe-video-3" :style="{ height: otheheight, width: othewidth }" class="video-box col-div othe-video-left"></div>
@@ -387,7 +387,7 @@ export default {
       console.log(this.sendmemo);
     },
     async initclient() {
-      this.userId_ = this.user.uid;
+      this.userId_ = '12345';
       const res = await this.gensignFetch({ userid: this.userId_ });
       if (this.$checkRes(res)) {
         this.client_ = TRTC.createClient({
@@ -408,8 +408,10 @@ export default {
           const userid_ = remoteStream.getUserId();
           const res_ = userid_.indexOf('-');
           const useridsplit_ = userid_.substring(0, 5);
+          console.log('222--->' + useridsplit_);
           if (useridsplit_ !== 'wxxcx') {
-            if (res_ === -1) {
+            if (useridsplit_ !== 'share') {
+              console.log('333');
               this.rvideoid_ = 'video_' + remoteStream.getId();
               remoteStream
                 .play('look-video-right')
@@ -443,9 +445,11 @@ export default {
                 });
             }
           } else {
-            this.index_ = index_ + 1;
-            if (this.index < 8) {
+            console.log('小程序进入画面' + this.index_);
+            this.index_ = this.index_ + 1;
+            if (this.index_ < 5) {
               const id_ = 'othe-video-' + this.index_;
+              console.log(id_);
               remoteStream.play(id_);
             }
           }
@@ -462,15 +466,29 @@ export default {
         this.client_.on('stream-removed', event => {
           const remoteStream = event.stream;
           console.log('stop----');
+          const userid_ = remoteStream.getUserId();
+          const useridsplit_ = userid_.substring(0, 5);
+          if (useridsplit_ === 'wxxcx') {
+            console.log('退出userid_' + useridsplit_);
+            // 订阅远端音频和视频流
+            if (this.index_ > 0) {
+              this.index_ = this.index_ - 1;
+            }
+          }
           remoteStream.stop();
         });
         this.client_.on('mute-video', event => {
           const remoteStream = event.stream;
+          console.log('退出');
+          console.log('退出remoteStream' + remoteStream);
           const userid_ = remoteStream.getUserId();
           const useridsplit_ = userid_.substring(0, 5);
-          if (useridsplit_ !== 'wxxcx') {
+          console.log('退出userid_' + userid_);
+
+          if (useridsplit_ === 'wxxcx') {
+            console.log('退出userid_' + useridsplit_);
             // 订阅远端音频和视频流
-            if (this.index_ > 1) {
+            if (this.index_ > 0) {
               this.index_ = this.index_ - 1;
             }
           }