[*] 日常优化

This commit is contained in:
acgist
2023-08-26 10:39:00 +08:00
parent 7e4230c214
commit 032021a72f
41 changed files with 103 additions and 86 deletions

View File

@@ -2444,37 +2444,6 @@ class Taoyao extends RemoteClient {
await me.mediaProduce();
}
/**
* 离开房间
*/
roomLeave() {
const me = this;
me.push(protocol.buildMessage("room::leave", {
roomId: me.roomId
}));
me.closeRoomMedia();
}
/**
* 离开房间信令
*
* @param {*} message
*/
defaultRoomLeave(message) {
const me = this;
const { clientId } = message.body;
if(clientId === me.clientId) {
me.closeRoomMedia();
} else if(me.remoteClients.has(clientId)) {
const remoteClient = me.remoteClients.get(clientId);
remoteClient.close();
me.remoteClients.delete(clientId);
console.debug("终端离开房间", clientId);
} else {
console.debug("离开终端无效", clientId);
}
}
/**
* 媒体回调
*
@@ -3018,6 +2987,36 @@ class Taoyao extends RemoteClient {
}
}
/**
* 离开房间信令
*/
roomLeave() {
this.push(protocol.buildMessage("room::leave", {
roomId: this.roomId
}));
this.closeRoomMedia();
}
/**
* 离开房间信令
*
* @param {*} message 信令消息
*/
defaultRoomLeave(message) {
const { clientId } = message.body;
if(clientId === this.clientId) {
this.closeRoomMedia();
console.debug("终端离开房间", clientId);
} else if(this.remoteClients.has(clientId)) {
const remoteClient = this.remoteClients.get(clientId);
remoteClient.close();
this.remoteClients.delete(clientId);
console.debug("终端离开房间", clientId);
} else {
console.debug("终端已经离开", clientId);
}
}
/**
* 房间列表信令
*