[mirotalksfu] - add receive file info & progress
هذا الالتزام موجود في:
@@ -187,6 +187,12 @@ access to use this app.
|
|||||||
<button id="sendAbortBtn" class="fas fa-stop-circle"> Abort</button>
|
<button id="sendAbortBtn" class="fas fa-stop-circle"> Abort</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="receiveFileDiv" class="fadein center">
|
||||||
|
<div id="receiveFileInfo"></div>
|
||||||
|
<div id="receiveFilePercentage"></div>
|
||||||
|
<progress id="receiveProgress" max="0" value="0"></progress>
|
||||||
|
</div>
|
||||||
|
|
||||||
<section id="participants" class="fadein center hidden">
|
<section id="participants" class="fadein center hidden">
|
||||||
<header id="participantsHeader" class="participants-header">
|
<header id="participantsHeader" class="participants-header">
|
||||||
<div id="participantsTitle" class="participants-header-title"></div>
|
<div id="participantsTitle" class="participants-header-title"></div>
|
||||||
|
|||||||
@@ -92,6 +92,12 @@ body {
|
|||||||
color: white;
|
color: white;
|
||||||
background: rgba(0, 0, 0, 0.4);
|
background: rgba(0, 0, 0, 0.4);
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
|
/* pulsate */
|
||||||
|
animation: pulsate 5s ease-out;
|
||||||
|
animation-iteration-count: infinite;
|
||||||
|
-webkit-animation: pulsate 5s ease-out;
|
||||||
|
-webkit-animation-iteration-count: infinite;
|
||||||
|
opacity: 0.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sidenav {
|
.sidenav {
|
||||||
@@ -581,7 +587,8 @@ button:hover {
|
|||||||
# Send File
|
# Send File
|
||||||
--------------------------------------------------------------*/
|
--------------------------------------------------------------*/
|
||||||
|
|
||||||
#sendFileDiv {
|
#sendFileDiv,
|
||||||
|
#receiveFileDiv {
|
||||||
z-index: 7;
|
z-index: 7;
|
||||||
display: none;
|
display: none;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
|
|||||||
@@ -1682,41 +1682,40 @@ class RoomClient {
|
|||||||
let fileToReceiveInfo =
|
let fileToReceiveInfo =
|
||||||
' From: ' +
|
' From: ' +
|
||||||
this.incomingFileInfo.peer_name +
|
this.incomingFileInfo.peer_name +
|
||||||
'\n' +
|
html.newline +
|
||||||
' incoming file: ' +
|
' Incoming file: ' +
|
||||||
this.incomingFileInfo.fileName +
|
this.incomingFileInfo.fileName +
|
||||||
'\n' +
|
html.newline +
|
||||||
' size: ' +
|
' File type: ' +
|
||||||
this.bytesToSize(this.incomingFileInfo.fileSize) +
|
this.incomingFileInfo.fileType +
|
||||||
'\n' +
|
html.newline +
|
||||||
' type: ' +
|
' File size: ' +
|
||||||
this.incomingFileInfo.fileType;
|
this.bytesToSize(this.incomingFileInfo.fileSize);
|
||||||
console.log(fileToReceiveInfo);
|
receiveFileInfo.innerHTML = fileToReceiveInfo;
|
||||||
|
receiveFileDiv.style.display = 'inline';
|
||||||
|
receiveProgress.max = this.incomingFileInfo.fileSize;
|
||||||
this.userLog('info', fileToReceiveInfo, 'top-end');
|
this.userLog('info', fileToReceiveInfo, 'top-end');
|
||||||
}
|
}
|
||||||
|
|
||||||
sendFileData() {
|
sendFileData() {
|
||||||
console.log(
|
console.log('Send file ', {
|
||||||
'Send file ' +
|
name: this.fileToSend.name,
|
||||||
this.fileToSend.name +
|
size: this.bytesToSize(this.fileToSend.size),
|
||||||
' size ' +
|
type: this.fileToSend.type,
|
||||||
this.bytesToSize(this.fileToSend.size) +
|
});
|
||||||
' type ' +
|
|
||||||
this.fileToSend.type,
|
|
||||||
);
|
|
||||||
|
|
||||||
this.sendInProgress = true;
|
this.sendInProgress = true;
|
||||||
|
|
||||||
sendFileInfo.innerHTML =
|
sendFileInfo.innerHTML =
|
||||||
'File name: ' +
|
'File name: ' +
|
||||||
this.fileToSend.name +
|
this.fileToSend.name +
|
||||||
'<br>' +
|
html.newline +
|
||||||
'File type: ' +
|
'File type: ' +
|
||||||
this.fileToSend.type +
|
this.fileToSend.type +
|
||||||
'<br>' +
|
html.newline +
|
||||||
'File size: ' +
|
'File size: ' +
|
||||||
this.bytesToSize(this.fileToSend.size) +
|
this.bytesToSize(this.fileToSend.size) +
|
||||||
'<br>';
|
html.newline;
|
||||||
|
|
||||||
sendFileDiv.style.display = 'inline';
|
sendFileDiv.style.display = 'inline';
|
||||||
sendProgress.max = this.fileToSend.size;
|
sendProgress.max = this.fileToSend.size;
|
||||||
@@ -1770,6 +1769,7 @@ class RoomClient {
|
|||||||
this.receiveBuffer = [];
|
this.receiveBuffer = [];
|
||||||
this.incomingFileData = [];
|
this.incomingFileData = [];
|
||||||
this.receivedSize = 0;
|
this.receivedSize = 0;
|
||||||
|
receiveFileDiv.style.display = 'none';
|
||||||
console.log(data.peer_name + ' aborted the file transfer');
|
console.log(data.peer_name + ' aborted the file transfer');
|
||||||
userLog('info', data.peer_name + ' ⚠️ aborted the file transfer', 'top-end');
|
userLog('info', data.peer_name + ' ⚠️ aborted the file transfer', 'top-end');
|
||||||
}
|
}
|
||||||
@@ -1777,9 +1777,11 @@ class RoomClient {
|
|||||||
handleFile(data) {
|
handleFile(data) {
|
||||||
this.receiveBuffer.push(data);
|
this.receiveBuffer.push(data);
|
||||||
this.receivedSize += data.byteLength;
|
this.receivedSize += data.byteLength;
|
||||||
// let getPercentage = ((receivedSize / this.incomingFileInfo.fileSize) * 100).toFixed(2);
|
receiveProgress.value = this.receivedSize;
|
||||||
// console.log("Received progress: " + getPercentage + "%");
|
receiveFilePercentage.innerHTML =
|
||||||
|
'Receive progress: ' + ((this.receivedSize / this.incomingFileInfo.fileSize) * 100).toFixed(2) + '%';
|
||||||
if (this.receivedSize === this.incomingFileInfo.fileSize) {
|
if (this.receivedSize === this.incomingFileInfo.fileSize) {
|
||||||
|
receiveFileDiv.style.display = 'none';
|
||||||
this.incomingFileData = this.receiveBuffer;
|
this.incomingFileData = this.receiveBuffer;
|
||||||
this.receiveBuffer = [];
|
this.receiveBuffer = [];
|
||||||
this.endFileDownload();
|
this.endFileDownload();
|
||||||
|
|||||||
المرجع في مشكلة جديدة
حظر مستخدم