[mirotalksfu] - fix fileTransfer in case peers disconnect

هذا الالتزام موجود في:
Miroslav Pejic
2021-10-07 14:38:53 +02:00
الأصل 774ff8bdf3
التزام a18dbb5325
3 ملفات معدلة مع 12 إضافات و0 حذوفات

عرض الملف

@@ -191,6 +191,7 @@ access to use this app.
<div id="receiveFileInfo"></div>
<div id="receiveFilePercentage"></div>
<progress id="receiveProgress" max="0" value="0"></progress>
<button id="receiveHideBtn" class="fas fa-eye-slash">&nbsp; Hide</button>
</div>
<section id="participants" class="fadein center hidden">

عرض الملف

@@ -642,6 +642,9 @@ function handleButtons() {
sendAbortBtn.onclick = () => {
rc.abortFileTransfer();
};
receiveHideBtn.onclick = () => {
rc.hideFileTransfer();
};
whiteboardButton.onclick = () => {
toggleWhiteboard();
};

عرض الملف

@@ -114,6 +114,7 @@ class RoomClient {
this.incomingFileInfo = null;
this.incomingFileData = null;
this.sendInProgress = false;
this.receiveInProgress = false;
this.fileSharingInput = '*';
this.chunkSize = 1024 * 16; // 16kb/s
@@ -1695,6 +1696,7 @@ class RoomClient {
receiveFileDiv.style.display = 'inline';
receiveProgress.max = this.incomingFileInfo.fileSize;
this.userLog('info', fileToReceiveInfo, 'top-end');
this.receiveInProgress = true;
}
sendFileData() {
@@ -1765,16 +1767,22 @@ class RoomClient {
}
}
hideFileTransfer() {
receiveFileDiv.style.display = 'none';
}
handleFileAbort(data) {
this.receiveBuffer = [];
this.incomingFileData = [];
this.receivedSize = 0;
this.receiveInProgress = false;
receiveFileDiv.style.display = 'none';
console.log(data.peer_name + ' aborted the file transfer');
userLog('info', data.peer_name + ' ⚠️ aborted the file transfer', 'top-end');
}
handleFile(data) {
if (!this.receiveInProgress) return;
this.receiveBuffer.push(data);
this.receivedSize += data.byteLength;
receiveProgress.value = this.receivedSize;