diff --git a/src/views/regime/Liveing.vue b/src/views/regime/Liveing.vue index fe33cb2..9292981 100644 --- a/src/views/regime/Liveing.vue +++ b/src/views/regime/Liveing.vue @@ -326,12 +326,14 @@ export default defineComponent({ userId: store.state.userinfo.memberid, userSig: userSig }); + // 监听远端开启推流 client.on('stream-added', (event: { stream: any }) => { const remoteStream = event.stream; console.log('远端流增加: ' + remoteStream.getId()); //订阅远端流 client.subscribe(remoteStream); }); + // 远端流初始化成功 本地播放 client.on('stream-subscribed', (event: { stream: any }) => { const remoteStream = event.stream; console.log(remoteStream); @@ -342,6 +344,29 @@ export default defineComponent({ } remoteStream.play('s-' + remoteStream.userId_); }); + // 远端关闭麦克风 + client.on('mute-audio', (event: any) => { + const userId = event.userId; + console.log(userId, '远端关闭麦克风') + }); + // 远端关闭摄像头 + client.on('mute-video', (event: any) => { + const userId = event.userId; + console.log(userId, '远端关闭摄像头') + + }); + // 远端打开麦克风 + client.on('unmute-audio', (event: any) => { + const userId = event.userId; + console.log(userId, '远端打开麦克风') + + }); + // 远端打开摄像头 + client.on('unmute-video', (event: any) => { + const userId = event.userId; + console.log(userId, '远端打开摄像头') + + }); client .join({ roomId: roominfo.value.roomid}) .catch((error: string) => {