Skip to content

Commit

Permalink
[mirotalksfu] - improve isPeerPresenter method
Browse files Browse the repository at this point in the history
  • Loading branch information
miroslavpejic85 committed Jun 12, 2023
1 parent c89b782 commit 215f54e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app/src/Server.js
Original file line number Diff line number Diff line change
Expand Up @@ -1147,22 +1147,27 @@ function startServer() {

async function isPeerPresenter(room_id, peer_name, peer_uuid) {
let isPresenter = false;

if (typeof presenters[room_id] === 'undefined' || presenters[room_id] === null) return false;

try {
isPresenter =
typeof presenters === '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;
} catch (err) {
log.error('isPeerPresenter', err);
return false;
}

log.debug('isPeerPresenter', {
room_id: room_id,
peer_name: peer_name,
peer_uuid: peer_uuid,
isPresenter: isPresenter,
});

return isPresenter;
}

Expand Down

0 comments on commit 215f54e

Please sign in to comment.