liuyu 4 tahun lalu
induk
melakukan
573dbf1a7a
1 mengubah file dengan 5 tambahan dan 5 penghapusan
  1. 5 5
      src/views/live/roomDetail.vue

+ 5 - 5
src/views/live/roomDetail.vue

@@ -384,7 +384,11 @@ export default {
           this.switchbtn = false;
           this.switchmeetbtn = false;
         }
-        if (body.switchrole !== 'anchor' && body.userid === this.user.uid) {
+        if (body.switchrole === 'audience' && body.userid === this.user.uid) {
+          this.stermStop(this.localStream_);
+          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(() => {
@@ -395,10 +399,6 @@ export default {
               //   // 取消发布本地流成功
               // });
             });
-            const oldstrem_ = _.find(this.stremlist, { type: 'mainr' });
-            this.stermStop(this.localStream_);
-            this.stermStop(oldstrem_.strem);
-            this.stermPlay(oldstrem_.strem, 'look-video-right');
           }
         }
       }