fixes related to recording state
This commit is contained in:
parent
f666578872
commit
f88def1790
|
|
@ -886,10 +886,11 @@ ConfigureTracksActions = @ConfigureTracksActions
|
|||
let detail, reason, timeline, title;
|
||||
logger.debug("SessionStore.onRecordingChanged: " + details.cause);
|
||||
//console.log("_DEBUG_* SessionStore.onRecordingChanged: " + JSON.stringify(details));
|
||||
this.isRecording = details.isRecording;
|
||||
//this.isRecording = details.isRecording;
|
||||
this.recordingClinetId = details.clientId;
|
||||
let recordingState = await this.recordingModel.getCurrentRecordingState();
|
||||
this.recordingOwnerId = recordingState.recordingOwnerId;
|
||||
this.isRecording = recordingState.isRecording;
|
||||
|
||||
switch (details.cause) {
|
||||
case 'started':
|
||||
|
|
@ -2148,7 +2149,7 @@ ConfigureTracksActions = @ConfigureTracksActions
|
|||
}
|
||||
}
|
||||
}));
|
||||
|
||||
|
||||
} else {
|
||||
if (this.rateSessionDialog == null) {
|
||||
this.rateSessionDialog = new context.JK.RateSessionDialog(context.JK.app);
|
||||
|
|
|
|||
|
|
@ -216,6 +216,7 @@
|
|||
}
|
||||
|
||||
function onServerStopRecording(recordingId) {
|
||||
//alert("onServerStopRecording")
|
||||
var session = context.SessionStore.getCurrentOrLastSession();
|
||||
|
||||
if (!session) {
|
||||
|
|
@ -236,6 +237,7 @@
|
|||
}
|
||||
|
||||
function handleRecordingStartResult(recordingId, result) {
|
||||
//alert("handleRecordingStartResult")
|
||||
var success = result.success;
|
||||
var reason = result.reason;
|
||||
var detail = result.detail
|
||||
|
|
@ -255,6 +257,7 @@
|
|||
}
|
||||
|
||||
function handleRecordingStopResult(recordingId, result) {
|
||||
//alert("handleRecordingStopResult")
|
||||
var success = result.success;
|
||||
var reason = result.reason;
|
||||
var detail = result.detail;
|
||||
|
|
@ -274,6 +277,7 @@
|
|||
}
|
||||
|
||||
function handleRecordingStarted(recordingId, result, clientId) {
|
||||
//alert("handleRecordingStarted")
|
||||
var success = result.success;
|
||||
var reason = result.reason;
|
||||
var detail = result.detail;
|
||||
|
|
@ -287,7 +291,9 @@
|
|||
currentOrLastRecordingId = recording.id;
|
||||
})
|
||||
.catch(function() {
|
||||
abortRecording(recordingId, 'populate-recording-info', app.clientId);
|
||||
//alert("handleRecordingStarted: recording not found " + recordingId)
|
||||
//TODO: commenting the following line to temporary fix for recording not found
|
||||
//abortRecording(recordingId, 'populate-recording-info', app.clientId);
|
||||
});
|
||||
|
||||
var details = {recordingId: recordingId, isRecording: false}
|
||||
|
|
@ -301,6 +307,7 @@
|
|||
}
|
||||
|
||||
function handleRecordingStopped(recordingId, result) {
|
||||
//alert("handleRecordingStopped")
|
||||
var session = context.SessionStore.getCurrentOrLastSession();
|
||||
|
||||
if(session) {
|
||||
|
|
@ -362,7 +369,104 @@
|
|||
})
|
||||
}
|
||||
|
||||
// function handleRecordingStarted(recordingId, result, clientId) {
|
||||
// var success = result.success;
|
||||
// var reason = result.reason;
|
||||
// var detail = result.detail;
|
||||
|
||||
// // in this scenario, we don't know all the tracks of the user.
|
||||
// // we need to ask sessionModel to populate us with the recording data ASAP
|
||||
// currentRecording = rest.getRecordingPromise({ id: recordingId })
|
||||
// currentRecording
|
||||
// .then(function (recording) {
|
||||
// currentRecordingId = recording.id;
|
||||
// currentOrLastRecordingId = recording.id;
|
||||
// })
|
||||
// .catch(function () {
|
||||
// abortRecording(recordingId, 'populate-recording-info', app.clientId);
|
||||
// });
|
||||
|
||||
// var details = { recordingId: recordingId, isRecording: false }
|
||||
// $self.triggerHandler('startingRecording', details);
|
||||
// context.RecordingActions.startingRecording(details)
|
||||
// currentlyRecording = true;
|
||||
|
||||
// details = { clientId: clientId, recordingId: recordingId, isRecording: true }
|
||||
// $self.triggerHandler('startedRecording', details);
|
||||
// context.RecordingActions.startedRecording(details)
|
||||
// }
|
||||
|
||||
// function handleRecordingStopped(recordingId, result) {
|
||||
// var session = context.SessionStore.getCurrentOrLastSession();
|
||||
// if (!session) {
|
||||
// logger.debug("no session, so no recording");
|
||||
// return;
|
||||
// }
|
||||
|
||||
// context.SessionStore.updateSessionInfo(session, true)
|
||||
|
||||
// getCurrentRecordingState().then(function (recordingState) {
|
||||
// if (recordingState.isRecording) {
|
||||
// // we are still recording, so don't transition to stopped
|
||||
// logger.debug("recording is still running, so don't transition to stopped");
|
||||
// return;
|
||||
// }
|
||||
|
||||
// if (recordingId == "video") {
|
||||
// // comes from VideoRecordingStopped
|
||||
// return;
|
||||
// }
|
||||
|
||||
// logger.debug("handleRecordingStopped " + recordingId, result)
|
||||
|
||||
// var success = result.success;
|
||||
// var reason = result.reason;
|
||||
// var detail = result.detail;
|
||||
|
||||
// var details = { recordingId: recordingId, reason: reason, detail: detail, isRecording: true }
|
||||
// $self.triggerHandler('stoppingRecording', details);
|
||||
// context.RecordingActions.stoppingRecording(details)
|
||||
|
||||
// // the backend says the recording must be stopped.
|
||||
// // tell the server to stop it too
|
||||
// rest.stopRecording({
|
||||
// id: recordingId
|
||||
// })
|
||||
// .always(function () {
|
||||
// transitionToStopped();
|
||||
// })
|
||||
// .fail(function (jqXHR, textStatus, errorMessage) {
|
||||
// if (jqXHR.status == 422) {
|
||||
// logger.debug("recording already stopped %o", arguments);
|
||||
// var details = { recordingId: recordingId, reason: reason, detail: detail, isRecording: false }
|
||||
// $self.triggerHandler('stoppedRecording', details);
|
||||
// context.RecordingActions.stoppedRecording(details)
|
||||
// }
|
||||
// else if (jqXHR.status == 404) {
|
||||
// logger.debug("recording is already deleted %o", arguments);
|
||||
// var details = { recordingId: recordingId, reason: reason, detail: detail, isRecording: false }
|
||||
// $self.triggerHandler('stoppedRecording', details);
|
||||
// context.RecordingActions.stoppedRecording(details)
|
||||
// }
|
||||
// else {
|
||||
// var details = { recordingId: recordingId, reason: textStatus, detail: errorMessage, isRecording: false }
|
||||
// $self.triggerHandler('stoppedRecording', details);
|
||||
// context.RecordingActions.stoppedRecording(details)
|
||||
// }
|
||||
// })
|
||||
// .done(function () {
|
||||
// var details = { recordingId: recordingId, reason: reason, detail: detail, isRecording: false }
|
||||
// $self.triggerHandler('stoppedRecording', details);
|
||||
// context.RecordingActions.stoppedRecording(details)
|
||||
// })
|
||||
// }).catch(function (error) {
|
||||
// console.error("Error reading recording state:", error);
|
||||
// });
|
||||
|
||||
// }
|
||||
|
||||
function handleRecordingAborted(recordingId, result) {
|
||||
//alert("handleRecordingAborted")
|
||||
if(recordingId == "video") {
|
||||
|
||||
// comes from AbortedVideoRecording
|
||||
|
|
@ -469,102 +573,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
function handleRecordingStarted(recordingId, result, clientId) {
|
||||
var success = result.success;
|
||||
var reason = result.reason;
|
||||
var detail = result.detail;
|
||||
|
||||
// in this scenario, we don't know all the tracks of the user.
|
||||
// we need to ask sessionModel to populate us with the recording data ASAP
|
||||
currentRecording = rest.getRecordingPromise({ id: recordingId })
|
||||
currentRecording
|
||||
.then(function (recording) {
|
||||
currentRecordingId = recording.id;
|
||||
currentOrLastRecordingId = recording.id;
|
||||
})
|
||||
.catch(function () {
|
||||
abortRecording(recordingId, 'populate-recording-info', app.clientId);
|
||||
});
|
||||
|
||||
var details = { recordingId: recordingId, isRecording: false }
|
||||
$self.triggerHandler('startingRecording', details);
|
||||
context.RecordingActions.startingRecording(details)
|
||||
currentlyRecording = true;
|
||||
|
||||
details = { clientId: clientId, recordingId: recordingId, isRecording: true }
|
||||
$self.triggerHandler('startedRecording', details);
|
||||
context.RecordingActions.startedRecording(details)
|
||||
}
|
||||
|
||||
function handleRecordingStopped(recordingId, result) {
|
||||
var session = context.SessionStore.getCurrentOrLastSession();
|
||||
if (!session) {
|
||||
logger.debug("no session, so no recording");
|
||||
return;
|
||||
}
|
||||
|
||||
context.SessionStore.updateSessionInfo(session, true)
|
||||
|
||||
getCurrentRecordingState().then(function (recordingState) {
|
||||
if (recordingState.isRecording) {
|
||||
// we are still recording, so don't transition to stopped
|
||||
logger.debug("recording is still running, so don't transition to stopped");
|
||||
return;
|
||||
}
|
||||
|
||||
if (recordingId == "video") {
|
||||
// comes from VideoRecordingStopped
|
||||
return;
|
||||
}
|
||||
|
||||
logger.debug("handleRecordingStopped " + recordingId, result)
|
||||
|
||||
var success = result.success;
|
||||
var reason = result.reason;
|
||||
var detail = result.detail;
|
||||
|
||||
var details = { recordingId: recordingId, reason: reason, detail: detail, isRecording: true }
|
||||
$self.triggerHandler('stoppingRecording', details);
|
||||
context.RecordingActions.stoppingRecording(details)
|
||||
|
||||
// the backend says the recording must be stopped.
|
||||
// tell the server to stop it too
|
||||
rest.stopRecording({
|
||||
id: recordingId
|
||||
})
|
||||
.always(function () {
|
||||
transitionToStopped();
|
||||
})
|
||||
.fail(function (jqXHR, textStatus, errorMessage) {
|
||||
if (jqXHR.status == 422) {
|
||||
logger.debug("recording already stopped %o", arguments);
|
||||
var details = { recordingId: recordingId, reason: reason, detail: detail, isRecording: false }
|
||||
$self.triggerHandler('stoppedRecording', details);
|
||||
context.RecordingActions.stoppedRecording(details)
|
||||
}
|
||||
else if (jqXHR.status == 404) {
|
||||
logger.debug("recording is already deleted %o", arguments);
|
||||
var details = { recordingId: recordingId, reason: reason, detail: detail, isRecording: false }
|
||||
$self.triggerHandler('stoppedRecording', details);
|
||||
context.RecordingActions.stoppedRecording(details)
|
||||
}
|
||||
else {
|
||||
var details = { recordingId: recordingId, reason: textStatus, detail: errorMessage, isRecording: false }
|
||||
$self.triggerHandler('stoppedRecording', details);
|
||||
context.RecordingActions.stoppedRecording(details)
|
||||
}
|
||||
})
|
||||
.done(function () {
|
||||
var details = { recordingId: recordingId, reason: reason, detail: detail, isRecording: false }
|
||||
$self.triggerHandler('stoppedRecording', details);
|
||||
context.RecordingActions.stoppedRecording(details)
|
||||
})
|
||||
}).catch(function (error) {
|
||||
console.error("Error reading recording state:", error);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
this.initialize = function() {
|
||||
};
|
||||
|
|
|
|||
|
|
@ -284,7 +284,6 @@
|
|||
}
|
||||
|
||||
async function performLeaveSession(deferred) {
|
||||
|
||||
logger.debug("SessionModel.leaveCurrentSession()");
|
||||
// TODO - sessionChanged will be called with currentSession = null\
|
||||
server.unregisterMessageCallback(context.JK.MessageType.SESSION_JOIN, trackChanges);
|
||||
|
|
|
|||
|
|
@ -254,6 +254,7 @@
|
|||
function registerSessionJoin() {
|
||||
context.JK.JamServer.registerMessageCallback(context.JK.MessageType.SESSION_JOIN, async function(header, payload) {
|
||||
logger.debug("Handling SESSION_JOIN msg " + JSON.stringify(payload));
|
||||
//alert("Sidebar: SESSION_JOIN");
|
||||
if (app.clientId != payload.client_id) {
|
||||
// display notification
|
||||
app.notify({
|
||||
|
|
@ -284,11 +285,15 @@
|
|||
function registerSessionDepart() {
|
||||
context.JK.JamServer.registerMessageCallback(context.JK.MessageType.SESSION_DEPART, async function(header, payload) {
|
||||
logger.debug("Handling SESSION_DEPART msg " + JSON.stringify(payload));
|
||||
|
||||
if (app.clientId != payload.client_id) {
|
||||
// console.log("Sidebar: SESSION_DEPART payload", payload);
|
||||
// console.log("Sidebar: SESSION_DEPART app.clientId", app.clientId);
|
||||
|
||||
|
||||
if (app.clientId !== payload.client_id) {
|
||||
var recordingId = payload.recording_id;
|
||||
|
||||
//console.log("Sidebar: SESSION_DEPART isRecording", context.RecordingStore.recordingModel.isRecording(recordingId));
|
||||
if (recordingId && context.RecordingStore.recordingModel.isRecording(recordingId)) {
|
||||
//alert("Sidebar: SESSION_DEPART: calling onServerStopRecording");
|
||||
context.RecordingStore.recordingModel.onServerStopRecording(recordingId);
|
||||
}
|
||||
else {
|
||||
|
|
@ -308,7 +313,7 @@
|
|||
function registerRecordingStarted() {
|
||||
context.JK.JamServer.registerMessageCallback(context.JK.MessageType.RECORDING_STARTED, function(header, payload) {
|
||||
logger.debug("Handling RECORDING_STARTED msg " + JSON.stringify(payload));
|
||||
|
||||
//alert("Sidebar: RECORDING_STARTED");
|
||||
app.notify({
|
||||
"title": "Recording Started",
|
||||
"text": payload.msg,
|
||||
|
|
@ -320,7 +325,7 @@
|
|||
function registerRecordingEnded() {
|
||||
context.JK.JamServer.registerMessageCallback(context.JK.MessageType.RECORDING_ENDED, function(header, payload) {
|
||||
logger.debug("Handling RECORDING_ENDED msg " + JSON.stringify(payload));
|
||||
|
||||
//alert("Sidebar: RECORDING_ENDED");
|
||||
app.notify({
|
||||
"title": "Recording Ended",
|
||||
"text": payload.msg,
|
||||
|
|
|
|||
Loading…
Reference in New Issue