diff --git a/web/app/assets/javascripts/recordingModel.js b/web/app/assets/javascripts/recordingModel.js index 1412a1f5e..6c7dd32a8 100644 --- a/web/app/assets/javascripts/recordingModel.js +++ b/web/app/assets/javascripts/recordingModel.js @@ -206,11 +206,32 @@ } function onServerStartRecording() { - + var session = context.SessionStore.getCurrentOrLastSession(); + if (!session) { + logger.debug("no session, so no recording"); + return; + } + context.SessionStore.updateSessionInfo(session) } function onServerStopRecording(recordingId) { - stopRecording(recordingId, null, null); + var session = context.SessionStore.getCurrentOrLastSession(); + + if (!session) { + logger.debug("no session, so no recording"); + return; + } + context.SessionStore.updateSessionInfo(session) + + getCurrentRecordingState().then(function (recordingState) { + if (recordingState.isRecording && recordingState.recordingOwnerId === app.currentUserId) { + // we are still recording, so don't transition to stopped + logger.debug("recording is still running, so don't transition to stopped"); + return; + } + stopRecording(recordingId, null, null); + }); + } async function handleRecordingStartResult(recordingId, result) {