[mirotalksfu] - add only host meeting recroding

هذا الالتزام موجود في:
Miroslav Pejic
2023-09-08 11:45:39 +02:00
الأصل db6e725489
التزام 0c5d45efbe
7 ملفات معدلة مع 213 إضافات و40 حذوفات

عرض الملف

@@ -7,17 +7,18 @@ const log = new Logger('Room');
module.exports = class Room {
constructor(room_id, worker, io) {
this.id = room_id;
this.survey = config.survey;
this.worker = worker;
this.router = null;
this.io = io;
this.audioLevelObserver = null;
this.audioLevelObserverEnabled = true;
this.audioLastUpdateTime = 0;
this.io = io;
this._isLocked = false;
this._isLobbyEnabled = false;
this._roomPassword = null;
this._hostOnlyRecording = false;
this.survey = config.survey;
this.peers = new Map();
this.router = null;
this.createTheRouter();
}
@@ -96,6 +97,23 @@ module.exports = class Room {
return this.router.rtpCapabilities;
}
// ####################################################
// ROOM INFO
// ####################################################
toJson() {
return {
id: this.id,
config: {
isLocked: this._isLocked,
isLobbyEnabled: this._isLobbyEnabled,
hostOnlyRecording: this._hostOnlyRecording,
},
survey: this.survey,
peers: JSON.stringify([...this.peers]),
};
}
// ####################################################
// PEERS
// ####################################################
@@ -112,14 +130,6 @@ module.exports = class Room {
return this.peers.size;
}
toJson() {
return {
id: this.id,
survey: this.survey,
peers: JSON.stringify([...this.peers]),
};
}
getProducerListForPeer() {
let producerList = [];
this.peers.forEach((peer) => {
@@ -276,6 +286,9 @@ module.exports = class Room {
isLobbyEnabled() {
return this._isLobbyEnabled;
}
isHostOnlyRecording() {
return this._hostOnlyRecording;
}
setLocked(status, password) {
this._isLocked = status;
this._roomPassword = password;
@@ -283,6 +296,9 @@ module.exports = class Room {
setLobbyEnabled(status) {
this._isLobbyEnabled = status;
}
setHostOnlyRecording(status) {
this._hostOnlyRecording = status;
}
// ####################################################
// SENDER

عرض الملف

@@ -669,10 +669,23 @@ function startServer() {
room.setLobbyEnabled(false);
room.broadCast(socket.id, 'roomAction', data.action);
break;
case 'hostOnlyRecordingOn':
if (!isPresenter) return;
room.setHostOnlyRecording(true);
room.broadCast(socket.id, 'roomAction', data.action);
break;
case 'hostOnlyRecordingOff':
if (!isPresenter) return;
room.setHostOnlyRecording(false);
room.broadCast(socket.id, 'roomAction', data.action);
break;
default:
break;
}
log.debug('Room status', {
locked: room.isLocked(),
lobby: room.isLobbyEnabled(),
hostOnlyRecording: room.isHostOnlyRecording(),
});
});