|
@@ -61,6 +61,7 @@ export default {
|
|
async toLook() {
|
|
async toLook() {
|
|
let roomNumber = `98${this.liveInfo.number}89`;
|
|
let roomNumber = `98${this.liveInfo.number}89`;
|
|
await this.client_.join({ roomId: roomNumber, role: 'anchor' });
|
|
await this.client_.join({ roomId: roomNumber, role: 'anchor' });
|
|
|
|
+ this.channel(roomNumber);
|
|
this.joinRoom(roomNumber);
|
|
this.joinRoom(roomNumber);
|
|
// 订阅其他用户音视频
|
|
// 订阅其他用户音视频
|
|
this.client_.on('stream-subscribed', event => {
|
|
this.client_.on('stream-subscribed', event => {
|
|
@@ -120,6 +121,25 @@ export default {
|
|
const { userid, name } = this.user;
|
|
const { userid, name } = this.user;
|
|
this.$emit('count', { userid, name, number });
|
|
this.$emit('count', { userid, name, number });
|
|
},
|
|
},
|
|
|
|
+ // 订阅人数
|
|
|
|
+ channel(roomNumber) {
|
|
|
|
+ if (!roomNumber) {
|
|
|
|
+ console.warn('未获取到房间号,无法进行订阅');
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ this.$stomp({
|
|
|
|
+ [`/exchange/liveroom-personcount/${roomNumber}`]: this.onMessage,
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ onMessage(message) {
|
|
|
|
+ let body = _.get(message, 'body');
|
|
|
|
+ if (body) {
|
|
|
|
+ if (body == '消息已查收') return;
|
|
|
|
+ body = JSON.parse(body);
|
|
|
|
+ console.log(body);
|
|
|
|
+ // this.chatList.push(body);
|
|
|
|
+ }
|
|
|
|
+ },
|
|
},
|
|
},
|
|
watch: {
|
|
watch: {
|
|
liveInfo: {
|
|
liveInfo: {
|