For reference, the following is what I currently do to workaround the “user leave without stopping local recording” issue.
const api = new JitsiMeetExternalAPI('MEET.DOMAIN.COM', {
roomName: 'YourRoomName',
parentNode: document.querySelector('#meet'),
configOverwrite: {
// Intercept button click of 'hangup' (Leave) and 'end-meeting' (End meeting for all)
buttonsWithNotifyClick: ['hangup', 'end-meeting']
}
};);
// track local recording state
let localRecordingInProgress = false;
api.addListener("recordingStatusChanged", function (e) {
if (e.mode === "local") {
localRecordingInProgress = e.on || false;
}
})
api.addListener("toolbarButtonClicked", function (e) {
// When hangup button click, show warning instead of leave if local recording still in progress
if (e.key === 'hangup') {
if (localRecordingInProgress) {
api.executeCommand("showNotification", {
title: "Recording still in progress",
description: "Please stop the recording before leaving the room in order to save it.",
type: "warning",
timeout: "medium",
})
} else {
// Local recording not active. Proceed with hangup.
api.executeCommand('hangup');
}
} else if (e.key === 'end-meeting') {
if (localRecordingInProgress) {
api.executeCommand("showNotification", {
title: "Recording still in progress",
description: "Please stop the recording before ending the meeting in order to save it.",
type: "warning",
timeout: "medium",
})
} else {
// Local recording not active. Proceed with hangup.
api.executeCommand('endConference');
}
}
});
N.B:
- This handles case where use clicks Leave button before stopping local recording. It cannot however deal with the case where user closes the tab or navigates away.
- Handling of end-meeting relies on IFrame API commands introduced in jitsi-meet 8072 (unstable) which, at the point of writing, has not yet hit stable.