liuyu 4 yıl önce
ebeveyn
işleme
f7d2e57818
1 değiştirilmiş dosya ile 14 ekleme ve 12 silme
  1. 14 12
      src/views/live/roomDetail.vue

+ 14 - 12
src/views/live/roomDetail.vue

@@ -384,21 +384,23 @@ export default {
           this.switchbtn = false;
           this.switchmeetbtn = false;
         }
-        if (body.switchrole === 'audience' && body.userid === this.user.uid) {
-          this.stermStop(this.localStream_);
+        if (body.switchrole === 'audience') {
           const oldstrem_ = _.find(this.stremlist, { type: 'mainr' });
           this.stermStop(oldstrem_.strem);
           this.stermPlay(oldstrem_.strem, 'look-video-right');
-          const videoTrack = this.localStream_.getVideoTrack();
-          if (videoTrack) {
-            this.localStream_.removeTrack(videoTrack).then(() => {
-              console.log('remove video call success');
-              // 关闭摄像头
-              videoTrack.stop();
-              // this.client_.unpublish(this.localStream_).then(() => {
-              //   // 取消发布本地流成功
-              // });
-            });
+          if (body.userid === this.user.uid) {
+            this.stermStop(this.localStream_);
+            const videoTrack = this.localStream_.getVideoTrack();
+            if (videoTrack) {
+              this.localStream_.removeTrack(videoTrack).then(() => {
+                console.log('remove video call success');
+                // 关闭摄像头
+                videoTrack.stop();
+                // this.client_.unpublish(this.localStream_).then(() => {
+                //   // 取消发布本地流成功
+                // });
+              });
+            }
           }
         }
       }