添加了监听

This commit is contained in:
luyuan 2020-11-09 15:12:04 +08:00
parent b683a58354
commit 3ece8985ca
Signed by: theluyuan
GPG Key ID: A7972FD973317FF3

View File

@ -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) => {