liuyu 4 anni fa
parent
commit
3f333e55b6
1 ha cambiato i file con 25 aggiunte e 0 eliminazioni
  1. 25 0
      src/views/live/roomDetail.vue

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

@@ -347,6 +347,9 @@ export default {
       this.$stomp({
         [`/exchange/switch_zjr_` + this.id]: this.onZjrMessage,
       });
+      this.$stomp({
+        [`/exchange/switch_zb_` + this.id]: this.onZbMessage,
+      });
     },
     onMessage(message) {
       // console.log('receive a message: ', message.body);
@@ -424,6 +427,14 @@ export default {
         }
       }
     },
+    onZbMessage(message) {
+      let body = _.get(message, 'body');
+      if (body) {
+        body = JSON.parse(body);
+        this.swichzjrstatus = false;
+        this.swichzbVideo(body.switchzjr);
+      }
+    },
     onOtheMessage(message) {
       let body = _.get(message, 'body');
       if (body) {
@@ -447,6 +458,20 @@ export default {
         this.stermPlay(swichstrem.strem, 'look-video-right');
       }
     },
+    async swichzbVideo(switchzjr) {
+      //
+      const oldstrem_ = _.find(this.stremlist, { type: 'mainr' });
+      if (oldstrem_) {
+        const swichstrem = _.find(this.stremMeetlist, { swichuserid: switchzjr });
+        this.stermStop(oldstrem_.strem);
+        if (swichstrem) {
+          this.stermStop(swichstrem.strem);
+        }
+        this.stermPlay(oldstrem_.strem, 'look-video-right');
+        const id_ = 'othe-video-' + swichstrem.index;
+        this.stermPlay(oldstrem_.strem, id_);
+      }
+    },
     async userswichrole() {
       // 根据房间id查询房间详细信息
       let result = await this.lookuserswichrole({ roomid: this.id, userid: this.user.uid });