From 3ece8985ca6e9b5e1fc0c0b4f652d1a013866f34 Mon Sep 17 00:00:00 2001 From: luyuan <1162963624@qq.com> Date: Mon, 9 Nov 2020 15:12:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BA=86=E7=9B=91=E5=90=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/regime/Liveing.vue | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) 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) => {