[mirotalksfu] - Improve is presenter logic
هذا الالتزام موجود في:
@@ -434,8 +434,10 @@ function getRoomPassword() {
|
||||
function getPeerInfo() {
|
||||
peer_info = {
|
||||
join_data_time: getDataTimeString(),
|
||||
peer_uuid: getUUID(),
|
||||
peer_id: socket.id,
|
||||
peer_name: peer_name,
|
||||
peer_presenter: isPresenter,
|
||||
peer_audio: isAudioAllowed,
|
||||
peer_video: isVideoAllowed,
|
||||
peer_screen: isScreenAllowed,
|
||||
@@ -1602,6 +1604,17 @@ function getDataTimeString() {
|
||||
return `${date}-${time}`;
|
||||
}
|
||||
|
||||
function getUUID() {
|
||||
const uuid4 = ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, (c) =>
|
||||
(c ^ (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (c / 4)))).toString(16),
|
||||
);
|
||||
if (window.localStorage.uuid) {
|
||||
return window.localStorage.uuid;
|
||||
}
|
||||
window.localStorage.uuid = uuid4;
|
||||
return uuid4;
|
||||
}
|
||||
|
||||
function showButtons() {
|
||||
if (
|
||||
isButtonsBarOver ||
|
||||
|
||||
@@ -305,7 +305,7 @@ class RoomClient {
|
||||
await this.handleRoomInfo(room);
|
||||
const data = await this.socket.request('getRouterRtpCapabilities');
|
||||
this.device = await this.loadDevice(data);
|
||||
console.log('07.1 ----> Get Router Rtp Capabilities codecs: ', this.device.rtpCapabilities.codecs);
|
||||
console.log('07.3 ----> Get Router Rtp Capabilities codecs: ', this.device.rtpCapabilities.codecs);
|
||||
await this.initTransports(this.device);
|
||||
await this.startLocalMedia();
|
||||
this.socket.emit('getProducers');
|
||||
@@ -314,18 +314,22 @@ class RoomClient {
|
||||
async handleRoomInfo(room) {
|
||||
let peers = new Map(JSON.parse(room.peers));
|
||||
participantsCount = peers.size;
|
||||
isPresenter = participantsCount > 1 ? false : true;
|
||||
handleRules(isPresenter);
|
||||
for (let peer of Array.from(peers.keys()).filter((id) => id == this.peer_id)) {
|
||||
let my_peer_info = peers.get(peer).peer_info;
|
||||
console.log('07.1 ----> My Peer info', my_peer_info);
|
||||
isPresenter = my_peer_info.peer_presenter;
|
||||
handleRules(isPresenter);
|
||||
}
|
||||
adaptAspectRatio(participantsCount);
|
||||
for (let peer of Array.from(peers.keys()).filter((id) => id !== this.peer_id)) {
|
||||
let peer_info = peers.get(peer).peer_info;
|
||||
// console.log('07 ----> Remote Peer info', peer_info);
|
||||
// console.log('07.1 ----> Remote Peer info', peer_info);
|
||||
if (!peer_info.peer_video) {
|
||||
await this.setVideoOff(peer_info, true);
|
||||
}
|
||||
}
|
||||
this.refreshParticipantsCount();
|
||||
console.log('06.2 Participants Count ---->', participantsCount);
|
||||
console.log('07.2 Participants Count ---->', participantsCount);
|
||||
// notify && participantsCount == 1 ? shareRoom() : sound('joined');
|
||||
if (notify && participantsCount == 1) {
|
||||
shareRoom();
|
||||
|
||||
المرجع في مشكلة جديدة
حظر مستخدم