[mirotalksfu] - add button save participants info
هذا الالتزام موجود في:
@@ -187,6 +187,7 @@ function initClient() {
|
||||
setTippy('chatGhostButton', 'Toggle transparent background', 'bottom');
|
||||
setTippy('chatCloseButton', 'Close', 'right');
|
||||
setTippy('participantsCloseBtn', 'Close', 'left');
|
||||
setTippy('participantsSaveBtn', 'Save participants info', 'right');
|
||||
}
|
||||
setupWhiteboard();
|
||||
initEnumerateDevices();
|
||||
@@ -432,9 +433,14 @@ function getRoomPassword() {
|
||||
|
||||
function getPeerInfo() {
|
||||
peer_info = {
|
||||
user_agent: userAgent,
|
||||
detect_rtc_version: DetectRTC.version,
|
||||
is_webrtc_supported: DetectRTC.isWebRTCSupported,
|
||||
join_data_time: getDataTimeString(),
|
||||
peer_id: socket.id,
|
||||
peer_name: peer_name,
|
||||
peer_audio: isAudioAllowed,
|
||||
peer_video: isVideoAllowed,
|
||||
peer_screen: isScreenAllowed,
|
||||
peer_video_privacy: isVideoPrivacyActive,
|
||||
peer_hand: false,
|
||||
is_desktop_device: !DetectRTC.isMobileDevice && !isTabletDevice && !isIPadDevice,
|
||||
is_mobile_device: DetectRTC.isMobileDevice,
|
||||
is_tablet_device: isTabletDevice,
|
||||
@@ -443,13 +449,7 @@ function getPeerInfo() {
|
||||
os_version: DetectRTC.osVersion,
|
||||
browser_name: DetectRTC.browser.name,
|
||||
browser_version: DetectRTC.browser.version,
|
||||
peer_id: socket.id,
|
||||
peer_name: peer_name,
|
||||
peer_audio: isAudioAllowed,
|
||||
peer_video: isVideoAllowed,
|
||||
peer_screen: isScreenAllowed,
|
||||
peer_video_privacy: isVideoPrivacyActive,
|
||||
peer_hand: false,
|
||||
user_agent: userAgent,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1088,6 +1088,9 @@ function handleButtons() {
|
||||
participantsCloseBtn.onclick = () => {
|
||||
toggleParticipants();
|
||||
};
|
||||
participantsSaveBtn.onclick = () => {
|
||||
saveRoomPeers();
|
||||
};
|
||||
lockRoomButton.onclick = () => {
|
||||
rc.roomAction('lock');
|
||||
};
|
||||
@@ -1577,6 +1580,21 @@ function saveDataToFile(dataURL, fileName) {
|
||||
}, 100);
|
||||
}
|
||||
|
||||
function saveObjToJsonFile(dataObj, name) {
|
||||
console.log('Save data', { dataObj: dataObj, name: name });
|
||||
const dataTime = getDataTimeString();
|
||||
let a = document.createElement('a');
|
||||
a.href = 'data:text/json;charset=utf-8,' + encodeURIComponent(JSON.stringify(dataObj, null, 1));
|
||||
a.download = `${dataTime}-${name}.txt`;
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
setTimeout(() => {
|
||||
document.body.removeChild(a);
|
||||
window.URL.revokeObjectURL(url);
|
||||
}, 100);
|
||||
sound('download');
|
||||
}
|
||||
|
||||
function getDataTimeString() {
|
||||
const d = new Date();
|
||||
const date = d.toISOString().split('T')[0];
|
||||
@@ -2072,9 +2090,22 @@ function toggleParticipants() {
|
||||
isParticipantsListOpen = !isParticipantsListOpen;
|
||||
}
|
||||
|
||||
async function getRoomParticipants(refresh = false) {
|
||||
async function getRoomPeers() {
|
||||
let room_info = await rc.getRoomInfo();
|
||||
let peers = new Map(JSON.parse(room_info.peers));
|
||||
return new Map(JSON.parse(room_info.peers));
|
||||
}
|
||||
|
||||
async function saveRoomPeers() {
|
||||
const peers = await getRoomPeers();
|
||||
let peersToSave = [];
|
||||
for (let peer of Array.from(peers.keys())) {
|
||||
peersToSave.push(peers.get(peer).peer_info);
|
||||
}
|
||||
saveObjToJsonFile(peersToSave, 'PARTICIPANTS');
|
||||
}
|
||||
|
||||
async function getRoomParticipants(refresh = false) {
|
||||
let peers = await getRoomPeers();
|
||||
let table = await getParticipantsTable(peers);
|
||||
|
||||
participantsCount = peers.size;
|
||||
|
||||
المرجع في مشكلة جديدة
حظر مستخدم