[mirotalksfu] - fix fileTransfer in case peers disconnect
هذا الالتزام موجود في:
@@ -191,6 +191,7 @@ access to use this app.
|
|||||||
<div id="receiveFileInfo"></div>
|
<div id="receiveFileInfo"></div>
|
||||||
<div id="receiveFilePercentage"></div>
|
<div id="receiveFilePercentage"></div>
|
||||||
<progress id="receiveProgress" max="0" value="0"></progress>
|
<progress id="receiveProgress" max="0" value="0"></progress>
|
||||||
|
<button id="receiveHideBtn" class="fas fa-eye-slash"> Hide</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<section id="participants" class="fadein center hidden">
|
<section id="participants" class="fadein center hidden">
|
||||||
|
|||||||
@@ -642,6 +642,9 @@ function handleButtons() {
|
|||||||
sendAbortBtn.onclick = () => {
|
sendAbortBtn.onclick = () => {
|
||||||
rc.abortFileTransfer();
|
rc.abortFileTransfer();
|
||||||
};
|
};
|
||||||
|
receiveHideBtn.onclick = () => {
|
||||||
|
rc.hideFileTransfer();
|
||||||
|
};
|
||||||
whiteboardButton.onclick = () => {
|
whiteboardButton.onclick = () => {
|
||||||
toggleWhiteboard();
|
toggleWhiteboard();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -114,6 +114,7 @@ class RoomClient {
|
|||||||
this.incomingFileInfo = null;
|
this.incomingFileInfo = null;
|
||||||
this.incomingFileData = null;
|
this.incomingFileData = null;
|
||||||
this.sendInProgress = false;
|
this.sendInProgress = false;
|
||||||
|
this.receiveInProgress = false;
|
||||||
this.fileSharingInput = '*';
|
this.fileSharingInput = '*';
|
||||||
this.chunkSize = 1024 * 16; // 16kb/s
|
this.chunkSize = 1024 * 16; // 16kb/s
|
||||||
|
|
||||||
@@ -1695,6 +1696,7 @@ class RoomClient {
|
|||||||
receiveFileDiv.style.display = 'inline';
|
receiveFileDiv.style.display = 'inline';
|
||||||
receiveProgress.max = this.incomingFileInfo.fileSize;
|
receiveProgress.max = this.incomingFileInfo.fileSize;
|
||||||
this.userLog('info', fileToReceiveInfo, 'top-end');
|
this.userLog('info', fileToReceiveInfo, 'top-end');
|
||||||
|
this.receiveInProgress = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
sendFileData() {
|
sendFileData() {
|
||||||
@@ -1765,16 +1767,22 @@ class RoomClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hideFileTransfer() {
|
||||||
|
receiveFileDiv.style.display = 'none';
|
||||||
|
}
|
||||||
|
|
||||||
handleFileAbort(data) {
|
handleFileAbort(data) {
|
||||||
this.receiveBuffer = [];
|
this.receiveBuffer = [];
|
||||||
this.incomingFileData = [];
|
this.incomingFileData = [];
|
||||||
this.receivedSize = 0;
|
this.receivedSize = 0;
|
||||||
|
this.receiveInProgress = false;
|
||||||
receiveFileDiv.style.display = 'none';
|
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');
|
||||||
}
|
}
|
||||||
|
|
||||||
handleFile(data) {
|
handleFile(data) {
|
||||||
|
if (!this.receiveInProgress) return;
|
||||||
this.receiveBuffer.push(data);
|
this.receiveBuffer.push(data);
|
||||||
this.receivedSize += data.byteLength;
|
this.receivedSize += data.byteLength;
|
||||||
receiveProgress.value = this.receivedSize;
|
receiveProgress.value = this.receivedSize;
|
||||||
|
|||||||
المرجع في مشكلة جديدة
حظر مستخدم