[mirotalksfu] - keep track of the files sent/received

هذا الالتزام موجود في:
Miroslav Pejic
2022-08-27 09:46:34 +02:00
الأصل 62bcf5166c
التزام fa1e842982
2 ملفات معدلة مع 31 إضافات و7 حذوفات

عرض الملف

@@ -455,12 +455,12 @@ io.on('connection', (socket) => {
socket.room_id = room_id;
if (roomList.has(socket.room_id)) {
callback('already exists');
callback({ error: 'already exists' });
} else {
log.debug('Created room', { room_id: socket.room_id });
let worker = await getMediasoupWorker();
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) {
return {
peer_name:
roomList.get(socket.room_id) &&
roomList.get(socket.room_id).getPeers().get(socket.id).peer_info.peer_name,
(roomList.get(socket.room_id) &&
roomList.get(socket.room_id).getPeers().get(socket.id).peer_info.peer_name) ||
undefined,
};
}
return (

عرض الملف

@@ -2419,15 +2419,25 @@ class RoomClient {
userLog('info', 'No participants detected', 'top-end');
return;
}
// send some metadata about our file to peers in the room
this.socket.emit('fileInfo', {
let fileInfo = {
peer_id: peer_id,
broadcast: broadcast,
peer_name: this.peer_name,
fileName: this.fileToSend.name,
fileSize: this.fileToSend.size,
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(() => {
this.sendFileData(peer_id, broadcast);
}, 1000);
@@ -2453,6 +2463,15 @@ class RoomClient {
html.newline +
' File size: ' +
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;
receiveFileDiv.style.display = 'inline';
receiveProgress.max = this.incomingFileInfo.fileSize;
@@ -2642,6 +2661,10 @@ class RoomClient {
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
// ####################################################