Skip to content

Commit

Permalink
[mirotalk] - on save recording failed print error.message
Browse files Browse the repository at this point in the history
  • Loading branch information
Miroslav Pejic committed Jun 4, 2021
1 parent a808fa5 commit 697de25
Showing 1 changed file with 29 additions and 25 deletions.
54 changes: 29 additions & 25 deletions www/js/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -2542,31 +2542,35 @@ function setRecordButtonUi() {
* Download recorded stream
*/
function downloadRecordedStream() {
const blob = new Blob(recordedBlobs, { type: "video/webm" });
const recFileName = getDataTimeString() + "-REC.webm";
const currentDevice = isMobileDevice ? "MOBILE" : "PC";
const blobFileSize = bytesToSize(blob.size);
userLog(
"success-html",
`<div style="text-align: left;">
Recording Info <br/>
FILE: ${recFileName} <br/>
SIZE: ${blobFileSize} <br/>
Please wait to be processed, then will be downloaded to your ${currentDevice} device.
</div>`
);
// save the recorded file to device
const url = window.URL.createObjectURL(blob);
const a = document.createElement("a");
a.style.display = "none";
a.href = url;
a.download = recFileName;
document.body.appendChild(a);
a.click();
setTimeout(() => {
document.body.removeChild(a);
window.URL.revokeObjectURL(url);
}, 100);
try {
const blob = new Blob(recordedBlobs, { type: "video/webm" });
const recFileName = getDataTimeString() + "-REC.webm";
const currentDevice = isMobileDevice ? "MOBILE" : "PC";
const blobFileSize = bytesToSize(blob.size);
userLog(
"success-html",
`<div style="text-align: left;">
Recording Info <br/>
FILE: ${recFileName} <br/>
SIZE: ${blobFileSize} <br/>
Please wait to be processed, then will be downloaded to your ${currentDevice} device.
</div>`
);
// save the recorded file to device
const url = window.URL.createObjectURL(blob);
const a = document.createElement("a");
a.style.display = "none";
a.href = url;
a.download = recFileName;
document.body.appendChild(a);
a.click();
setTimeout(() => {
document.body.removeChild(a);
window.URL.revokeObjectURL(url);
}, 100);
} catch (error) {
userLog("error", "Recording save failed: " + error.message);
}
}

/**
Expand Down

0 comments on commit 697de25

Please sign in to comment.