[mirotalksfu] - keep track of the files sent/received
هذا الالتزام موجود في:
@@ -455,12 +455,12 @@ io.on('connection', (socket) => {
|
|||||||
socket.room_id = room_id;
|
socket.room_id = room_id;
|
||||||
|
|
||||||
if (roomList.has(socket.room_id)) {
|
if (roomList.has(socket.room_id)) {
|
||||||
callback('already exists');
|
callback({ error: 'already exists' });
|
||||||
} else {
|
} else {
|
||||||
log.debug('Created room', { room_id: socket.room_id });
|
log.debug('Created room', { room_id: socket.room_id });
|
||||||
let worker = await getMediasoupWorker();
|
let worker = await getMediasoupWorker();
|
||||||
roomList.set(socket.room_id, new Room(socket.room_id, worker, io));
|
roomList.set(socket.room_id, new Room(socket.room_id, worker, io));
|
||||||
callback(socket.room_id);
|
callback({ room_id: socket.room_id });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -790,8 +790,9 @@ io.on('connection', (socket) => {
|
|||||||
if (json) {
|
if (json) {
|
||||||
return {
|
return {
|
||||||
peer_name:
|
peer_name:
|
||||||
roomList.get(socket.room_id) &&
|
(roomList.get(socket.room_id) &&
|
||||||
roomList.get(socket.room_id).getPeers().get(socket.id).peer_info.peer_name,
|
roomList.get(socket.room_id).getPeers().get(socket.id).peer_info.peer_name) ||
|
||||||
|
undefined,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -2419,15 +2419,25 @@ class RoomClient {
|
|||||||
userLog('info', 'No participants detected', 'top-end');
|
userLog('info', 'No participants detected', 'top-end');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// send some metadata about our file to peers in the room
|
let fileInfo = {
|
||||||
this.socket.emit('fileInfo', {
|
|
||||||
peer_id: peer_id,
|
peer_id: peer_id,
|
||||||
broadcast: broadcast,
|
broadcast: broadcast,
|
||||||
peer_name: this.peer_name,
|
peer_name: this.peer_name,
|
||||||
fileName: this.fileToSend.name,
|
fileName: this.fileToSend.name,
|
||||||
fileSize: this.fileToSend.size,
|
fileSize: this.fileToSend.size,
|
||||||
fileType: this.fileToSend.type,
|
fileType: this.fileToSend.type,
|
||||||
});
|
};
|
||||||
|
this.appendMessage(
|
||||||
|
'right',
|
||||||
|
this.rightMsgAvatar,
|
||||||
|
this.peer_name,
|
||||||
|
this.peer_id,
|
||||||
|
'Send File: \n' + this.toHtmlJson(fileInfo),
|
||||||
|
'all',
|
||||||
|
'all',
|
||||||
|
);
|
||||||
|
// send some metadata about our file to peers in the room
|
||||||
|
this.socket.emit('fileInfo', fileInfo);
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.sendFileData(peer_id, broadcast);
|
this.sendFileData(peer_id, broadcast);
|
||||||
}, 1000);
|
}, 1000);
|
||||||
@@ -2453,6 +2463,15 @@ class RoomClient {
|
|||||||
html.newline +
|
html.newline +
|
||||||
' File size: ' +
|
' File size: ' +
|
||||||
this.bytesToSize(this.incomingFileInfo.fileSize);
|
this.bytesToSize(this.incomingFileInfo.fileSize);
|
||||||
|
this.appendMessage(
|
||||||
|
'left',
|
||||||
|
this.leftMsgAvatar,
|
||||||
|
this.incomingFileInfo.peer_name,
|
||||||
|
this.incomingFileInfo.peer_id,
|
||||||
|
'Receive File: \n' + this.toHtmlJson(this.incomingFileInfo),
|
||||||
|
'all',
|
||||||
|
'all',
|
||||||
|
);
|
||||||
receiveFileInfo.innerHTML = fileToReceiveInfo;
|
receiveFileInfo.innerHTML = fileToReceiveInfo;
|
||||||
receiveFileDiv.style.display = 'inline';
|
receiveFileDiv.style.display = 'inline';
|
||||||
receiveProgress.max = this.incomingFileInfo.fileSize;
|
receiveProgress.max = this.incomingFileInfo.fileSize;
|
||||||
@@ -2642,6 +2661,10 @@ class RoomClient {
|
|||||||
return Math.round(bytes / Math.pow(1024, i), 2) + ' ' + sizes[i];
|
return Math.round(bytes / Math.pow(1024, i), 2) + ' ' + sizes[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
toHtmlJson(obj) {
|
||||||
|
return '<pre>' + JSON.stringify(obj, null, 4) + '</pre>';
|
||||||
|
}
|
||||||
|
|
||||||
// ####################################################
|
// ####################################################
|
||||||
// SHARE VIDEO YOUTUBE - MP4 - WEBM - OGG or AUDIO mp3
|
// SHARE VIDEO YOUTUBE - MP4 - WEBM - OGG or AUDIO mp3
|
||||||
// ####################################################
|
// ####################################################
|
||||||
|
|||||||
المرجع في مشكلة جديدة
حظر مستخدم