[mirotalksfu] - improve isPresenter

هذا الالتزام موجود في:
Miroslav Pejic
2023-11-19 09:51:30 +01:00
الأصل 3ce1c61010
التزام 06a0fe77b1
5 ملفات معدلة مع 32 إضافات و15 حذوفات

عرض الملف

@@ -40,7 +40,7 @@ dependencies: {
* @license For commercial or closed source, contact us at license.mirotalk@gmail.com or purchase directly via CodeCanyon
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-sfu-webrtc-realtime-video-conferences/40769970
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
* @version 1.2.3
* @version 1.2.4
*
*/
@@ -897,13 +897,21 @@ function startServer() {
const peer_name = room.getPeers()?.get(socket.id)?.peer_info?.peer_name;
const peer_uuid = room.getPeers()?.get(socket.id)?.peer_info?.peer_uuid;
if (Object.keys(presenters[socket.room_id]).length === 0) {
presenters[socket.room_id] = {
// Set the presenters
const presenter = {
peer_ip: peer_ip,
peer_name: peer_name,
peer_uuid: peer_uuid,
is_presenter: true,
};
// first we check if the username match the presenter username
if (config.presenter && peer_name === config.presenter.username) {
presenters[socket.room_id] = presenter;
} else {
// if not match the first one who join room is the presenter
if (Object.keys(presenters[socket.room_id]).length === 0) {
presenters[socket.room_id] = presenter;
}
}
log.debug('[Join] - Connected presenters grp by roomId', presenters);
@@ -1300,10 +1308,11 @@ function startServer() {
try {
isPresenter =
typeof presenters[room_id] === 'object' &&
(typeof presenters[room_id] === 'object' &&
Object.keys(presenters[room_id]).length > 1 &&
presenters[room_id]['peer_name'] === peer_name &&
presenters[room_id]['peer_uuid'] === peer_uuid;
presenters[room_id]['peer_uuid'] === peer_uuid) ||
(config.presenter && peer_name === config.presenter.username);
} catch (err) {
log.error('isPeerPresenter', err);
return false;

عرض الملف

@@ -46,6 +46,14 @@ module.exports = {
username: 'username',
password: 'password',
},
presenter: {
/*
By default, the presenter is identified as the first participant to join the room, identified by username and uuid.
Additional layers can be added to specify the presenter by setting a designated username.
This username can also be used to apply presenter rules to another participant with the same username.
*/
username: 'Miroslav Pejic',
},
console: {
debug: true,
colors: true,

عرض الملف

@@ -1,6 +1,6 @@
{
"name": "mirotalksfu",
"version": "1.2.3",
"version": "1.2.4",
"description": "WebRTC SFU browser-based video calls",
"main": "Server.js",
"scripts": {

عرض الملف

@@ -11,7 +11,7 @@ if (location.href.substr(0, 5) !== 'https') location.href = 'https' + location.h
* @license For commercial or closed source, contact us at license.mirotalk@gmail.com or purchase directly via CodeCanyon
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-sfu-webrtc-realtime-video-conferences/40769970
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
* @version 1.2.3
* @version 1.2.4
*
*/

عرض الملف

@@ -9,7 +9,7 @@
* @license For commercial or closed source, contact us at license.mirotalk@gmail.com or purchase directly via CodeCanyon
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-sfu-webrtc-realtime-video-conferences/40769970
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
* @version 1.2.3
* @version 1.2.4
*
*/