diff --git a/public/js/Room.js b/public/js/Room.js index a0a0054f..cb56bea4 100644 --- a/public/js/Room.js +++ b/public/js/Room.js @@ -1342,6 +1342,9 @@ function handleButtons() { isRecording ? stopRecButton.click() : startRecButton.click(); }; startRecButton.onclick = () => { + if (participantsCount == 1 && !rc.peer_info.peer_audio) { + return userLog('warning', '🔴 Recording requires your audio to be enabled', 'top-end', 6000); + } rc.startRecording(); }; stopRecButton.onclick = () => { @@ -2289,8 +2292,7 @@ function handleRoomClientEvents() { console.log('Room event: host only recording enabled'); // Stop recording ... if (rc.isRecording() || recordingStatus.innerText != '0s') { - console.log('Room event: host only recording enabled, going to stop recording'); - rc.stopRecording(); + rc.saveRecording('Room event: host only recording enabled, going to stop recording'); } hide(startRecButton); hide(roomRecording); @@ -2314,8 +2316,7 @@ function handleRoomClientEvents() { rc.on(RoomClient.EVENTS.exitRoom, () => { console.log('Room event: Client leave room'); if (rc.isRecording() || recordingStatus.innerText != '0s') { - console.log('Room event: Client save recording before to exit'); - rc.stopRecording(); + rc.saveRecording('Room event: Client save recording before to exit'); } if (survey && survey.enabled) { leaveFeedback(); diff --git a/public/js/RoomClient.js b/public/js/RoomClient.js index b2a9cd69..edcc7041 100644 --- a/public/js/RoomClient.js +++ b/public/js/RoomClient.js @@ -860,6 +860,7 @@ class RoomClient { function () { this.exit(true); this.ServerAway(); + this.saveRecording('Socket disconnected'); }.bind(this), ); } @@ -4051,19 +4052,21 @@ class RoomClient { lastRecordingInfo.innerHTML = `Last Recording Info: ${recordingInfo}`; show(lastRecordingInfo); - Swal.fire({ - background: swalBackground, - position: 'center', - icon: 'success', - title: 'Recording', - html: `
- 🔴 Recording Info: - ${recordingInfo} - Please wait to be processed, then will be downloaded to your ${currentDevice} device. -
`, - showClass: { popup: 'animate__animated animate__fadeInDown' }, - hideClass: { popup: 'animate__animated animate__fadeOutUp' }, - }); + if (window.localStorage.isReconnected === 'false') { + Swal.fire({ + background: swalBackground, + position: 'center', + icon: 'success', + title: 'Recording', + html: `
+ 🔴 Recording Info: + ${recordingInfo} + Please wait to be processed, then will be downloaded to your ${currentDevice} device. +
`, + showClass: { popup: 'animate__animated animate__fadeInDown' }, + hideClass: { popup: 'animate__animated animate__fadeOutUp' }, + }); + } console.log('MediaRecorder Download Blobs'); const url = window.URL.createObjectURL(blob); @@ -4159,6 +4162,13 @@ class RoomClient { ); } + saveRecording(reason) { + if (this._isRecording || recordingStatus.innerText != '0s') { + console.log(`Save recording: ${reason}`); + this.stopRecording(); + } + } + // #################################################### // FILE SHARING // ####################################################