This commit is contained in:
Nuwan 2025-04-17 00:35:54 +05:30
parent ce5bb82fb5
commit fdb392f723
1 changed files with 313 additions and 141 deletions

View File

@ -732,134 +732,189 @@ ConfigureTracksActions = @ConfigureTracksActions
# @issueChange()
# onRecordingChanged: `async function(details) {
# let detail, reason, timeline, title;
# logger.debug("SessionStore.onRecordingChanged: " + details.cause);
# console.log("_DEBUG_ SessionStore.onRecordingChanged: " + JSON.stringify(details));
# this.isRecording = details.isRecording;
# this.recordingClinetId = details.clientId;
# switch (details.cause) {
# case 'started':
# if (details.reason) {
# ({
# reason
# } = details);
# ({
# detail
# } = details);
# title = "Could Not Start Recording";
# switch (reason) {
# case 'client-no-response':
# this.notifyWithUserInfo(title, 'did not respond to the start signal.', detail);
# break;
# case 'empty-recording-id':
# this.app.notifyAlert(title, "No recording ID specified.");
# break;
# case 'missing-client':
# this.notifyWithUserInfo(title, 'could not be signalled to start recording.', detail);
# break;
# case 'already-recording':
# this.app.notifyAlert(title, 'Already recording. If this appears incorrect, try restarting JamKazam.');
# break;
# case 'recording-engine-unspecified':
# this.notifyWithUserInfo(title, 'had a problem writing recording data to disk.', detail);
# break;
# case 'recording-engine-create-directory':
# this.notifyWithUserInfo(title, 'had a problem creating a recording folder.', detail);
# break;
# case 'recording-engine-create-file':
# this.notifyWithUserInfo(title, 'had a problem creating a recording file.', detail);
# break;
# case 'recording-engine-sample-rate':
# this.notifyWithUserInfo(title, 'had a problem recording at the specified sample rate.', detail);
# break;
# case 'rest':
# var jqXHR = detail[0];
# this.app.notifyServerError(jqXHR);
# break;
# default:
# this.notifyWithUserInfo(title, 'Error Reason: ' + reason);
# }
# } else {
# this.displayWhoCreatedRecording(details.clientId);
# }
# break;
# case 'stopped':
# if (this.selfOpenedJamTracks()) {
# timeline = await context.jamClient.GetJamTrackTimeline();
# rest.addRecordingTimeline(details.recordingId, timeline)
# .fail(()=> {
# return this.app.notify({
# title: "Unable to Add JamTrack Volume Data",
# text: "The volume of the JamTrack will not be correct in the recorded mix."
# }, null, true);
# });
# }
# if (details.reason) {
# logger.warn("Recording Discarded: ", details);
# ({
# reason
# } = details);
# ({
# detail
# } = details);
# title = "Recording Discarded";
# switch (reason) {
# case 'client-no-response':
# this.notifyWithUserInfo(title, 'did not respond to the stop signal.', detail);
# break;
# case 'missing-client':
# this.notifyWithUserInfo(title, 'could not be signalled to stop recording.', detail);
# break;
# case 'empty-recording-id':
# this.app.notifyAlert(title, "No recording ID specified.");
# break;
# case 'wrong-recording-id':
# this.app.notifyAlert(title, "Wrong recording ID specified.");
# break;
# case 'not-recording':
# this.app.notifyAlert(title, "Not currently recording.");
# break;
# case 'already-stopping':
# this.app.notifyAlert(title, "Already stopping the current recording.");
# break;
# case 'start-before-stop':
# this.notifyWithUserInfo(title, 'asked that we start a new recording; cancelling the current one.', detail);
# break;
# default:
# this.app.notifyAlert(title, "Error reason: " + reason);
# }
# } else {
# logger.debug('backend opens recording files directory.')
# }
# break;
# case 'abortedRecording':
# ({
# reason
# } = details);
# ({
# detail
# } = details);
# title = "Recording Cancelled";
# switch (reason) {
# case 'client-no-response':
# this.notifyWithUserInfo(title, 'did not respond to the start signal.', detail);
# break;
# case 'missing-client':
# this.notifyWithUserInfo(title, 'could not be signalled to start recording.', detail);
# break;
# case 'populate-recording-info':
# this.notifyWithUserInfo(title, 'could not synchronize with the server.', detail);
# break;
# case 'recording-engine-unspecified':
# this.notifyWithUserInfo(title, 'had a problem writing recording data to disk.', detail);
# break;
# case 'recording-engine-create-directory':
# this.notifyWithUserInfo(title, 'had a problem creating a recording folder.', detail);
# break;
# case 'recording-engine-create-file':
# this.notifyWithUserInfo(title, 'had a problem creating a recording file.', detail);
# break;
# case 'recording-engine-sample-rate':
# this.notifyWithUserInfo(title, 'had a problem recording at the specified sample rate.', detail);
# break;
# default:
# this.app.notifyAlert(title, "Error reason: " + reason);
# }
# break;
# }
# return this.issueChange();
# }`
onRecordingChanged: `async function(details) {
let detail, reason, timeline, title;
logger.debug("SessionStore.onRecordingChanged: " + details.cause);
console.log("_DEBUG_ SessionStore.onRecordingChanged: " + JSON.stringify(details));
this.isRecording = details.isRecording;
this.recordingClinetId = details.clientId;
let detail, reason, timeline, title;
logger.debug("SessionStore.onRecordingChanged: " + details.cause);
//console.log("_DEBUG_* SessionStore.onRecordingChanged: " + JSON.stringify(details));
this.isRecording = details.isRecording;
this.recordingClinetId = details.clientId;
let recordingState = await this.recordingModel.getCurrentRecordingState();
this.recordingOwnerId = recordingState.recordingOwnerId;
switch (details.cause) {
case 'started':
switch (details.cause) {
case 'started':
if (details.reason) {
({
reason
} = details);
({
detail
} = details);
title = "Could Not Start Recording";
switch (reason) {
case 'client-no-response':
this.notifyWithUserInfo(title, 'did not respond to the start signal.', detail);
break;
case 'empty-recording-id':
this.app.notifyAlert(title, "No recording ID specified.");
break;
case 'missing-client':
this.notifyWithUserInfo(title, 'could not be signalled to start recording.', detail);
break;
case 'already-recording':
this.app.notifyAlert(title, 'Already recording. If this appears incorrect, try restarting JamKazam.');
break;
case 'recording-engine-unspecified':
this.notifyWithUserInfo(title, 'had a problem writing recording data to disk.', detail);
break;
case 'recording-engine-create-directory':
this.notifyWithUserInfo(title, 'had a problem creating a recording folder.', detail);
break;
case 'recording-engine-create-file':
this.notifyWithUserInfo(title, 'had a problem creating a recording file.', detail);
break;
case 'recording-engine-sample-rate':
this.notifyWithUserInfo(title, 'had a problem recording at the specified sample rate.', detail);
break;
case 'rest':
var jqXHR = detail[0];
this.app.notifyServerError(jqXHR);
break;
default:
this.notifyWithUserInfo(title, 'Error Reason: ' + reason);
}
} else {
this.displayWhoCreatedRecording(details.clientId);
}
break;
case 'stopped':
if (this.selfOpenedJamTracks()) {
timeline = await context.jamClient.GetJamTrackTimeline();
rest.addRecordingTimeline(details.recordingId, timeline)
.fail(()=> {
return this.app.notify({
title: "Unable to Add JamTrack Volume Data",
text: "The volume of the JamTrack will not be correct in the recorded mix."
}, null, true);
});
}
if (details.reason) {
logger.warn("Recording Discarded: ", details);
({
reason
} = details);
({
detail
} = details);
title = "Recording Discarded";
switch (reason) {
case 'client-no-response':
this.notifyWithUserInfo(title, 'did not respond to the stop signal.', detail);
break;
case 'missing-client':
this.notifyWithUserInfo(title, 'could not be signalled to stop recording.', detail);
break;
case 'empty-recording-id':
this.app.notifyAlert(title, "No recording ID specified.");
break;
case 'wrong-recording-id':
this.app.notifyAlert(title, "Wrong recording ID specified.");
break;
case 'not-recording':
this.app.notifyAlert(title, "Not currently recording.");
break;
case 'already-stopping':
this.app.notifyAlert(title, "Already stopping the current recording.");
break;
case 'start-before-stop':
this.notifyWithUserInfo(title, 'asked that we start a new recording; cancelling the current one.', detail);
break;
default:
this.app.notifyAlert(title, "Error reason: " + reason);
}
} else {
logger.debug('backend opens recording files directory.')
}
break;
case 'abortedRecording':
if (details.reason) {
({
reason
} = details);
({
detail
} = details);
title = "Recording Cancelled";
title = "Could Not Start Recording";
switch (reason) {
case 'client-no-response':
this.notifyWithUserInfo(title, 'did not respond to the start signal.', detail);
break;
case 'empty-recording-id':
this.app.notifyAlert(title, "No recording ID specified.");
break;
case 'missing-client':
this.notifyWithUserInfo(title, 'could not be signalled to start recording.', detail);
break;
case 'populate-recording-info':
this.notifyWithUserInfo(title, 'could not synchronize with the server.', detail);
case 'already-recording':
this.app.notifyAlert(title, 'Already recording. If this appears incorrect, try restarting JamKazam.');
break;
case 'recording-engine-unspecified':
this.notifyWithUserInfo(title, 'had a problem writing recording data to disk.', detail);
@ -873,14 +928,111 @@ ConfigureTracksActions = @ConfigureTracksActions
case 'recording-engine-sample-rate':
this.notifyWithUserInfo(title, 'had a problem recording at the specified sample rate.', detail);
break;
case 'rest':
var jqXHR = detail[0];
this.app.notifyServerError(jqXHR);
break;
default:
this.notifyWithUserInfo(title, 'Error Reason: ' + reason);
}
} else {
this.displayWhoCreatedRecording(details.clientId);
}
break;
case 'stopped':
if (this.selfOpenedJamTracks()) {
timeline = await context.jamClient.GetJamTrackTimeline();
rest.addRecordingTimeline(details.recordingId, timeline)
.fail(()=> {
return this.app.notify({
title: "Unable to Add JamTrack Volume Data",
text: "The volume of the JamTrack will not be correct in the recorded mix."
}, null, true);
});
}
if (details.reason) {
logger.warn("Recording Discarded: ", details);
({
reason
} = details);
({
detail
} = details);
title = "Recording Discarded";
switch (reason) {
case 'client-no-response':
this.notifyWithUserInfo(title, 'did not respond to the stop signal.', detail);
break;
case 'missing-client':
this.notifyWithUserInfo(title, 'could not be signalled to stop recording.', detail);
break;
case 'empty-recording-id':
this.app.notifyAlert(title, "No recording ID specified.");
break;
case 'wrong-recording-id':
this.app.notifyAlert(title, "Wrong recording ID specified.");
break;
case 'not-recording':
this.app.notifyAlert(title, "Not currently recording.");
break;
case 'already-stopping':
this.app.notifyAlert(title, "Already stopping the current recording.");
break;
case 'start-before-stop':
this.notifyWithUserInfo(title, 'asked that we start a new recording; cancelling the current one.', detail);
break;
default:
this.app.notifyAlert(title, "Error reason: " + reason);
}
break;
}
} else {
logger.debug('backend opens recording files directory.')
}
break;
return this.issueChange();
}`
case 'abortedRecording':
({
reason
} = details);
({
detail
} = details);
title = "Recording Cancelled";
switch (reason) {
case 'client-no-response':
this.notifyWithUserInfo(title, 'did not respond to the start signal.', detail);
break;
case 'missing-client':
this.notifyWithUserInfo(title, 'could not be signalled to start recording.', detail);
break;
case 'populate-recording-info':
this.notifyWithUserInfo(title, 'could not synchronize with the server.', detail);
break;
case 'recording-engine-unspecified':
this.notifyWithUserInfo(title, 'had a problem writing recording data to disk.', detail);
break;
case 'recording-engine-create-directory':
this.notifyWithUserInfo(title, 'had a problem creating a recording folder.', detail);
break;
case 'recording-engine-create-file':
this.notifyWithUserInfo(title, 'had a problem creating a recording file.', detail);
break;
case 'recording-engine-sample-rate':
this.notifyWithUserInfo(title, 'had a problem recording at the specified sample rate.', detail);
break;
default:
this.app.notifyAlert(title, "Error reason: " + reason);
}
break;
}
return this.issueChange();
}`
notifyWithUserInfo: (title , text, clientId) ->
@findUserBy({clientId: clientId})
@ -1631,35 +1783,55 @@ ConfigureTracksActions = @ConfigureTracksActions
# else
# logger.info("ignoring refresh because we already have current: " + @currentTrackChanges + ", seen: " + session.track_changes_counter);
updateSessionInfo: `function(session, force) {
console.log("_DEBUG_* SessionStore#updateSessionInfo", session);
if ((force === true) || (this.currentTrackChanges < session.track_changes_counter)) {
logger.debug("updating current track changes from %o to %o", this.currentTrackChanges, session.track_changes_counter);
this.currentTrackChanges = session.track_changes_counter;
this.sendClientParticipantChanges(this.currentSession, session);
this.recordingModel.getRecordingState().then(
(recordingState) => {
if (recordingState) {
//merge the recording state with the session
console.log("_DEBUG_* SessionStore getRecordingState -> recordingState", recordingState);
session = {...session, ...recordingState};
}
}
).finally(() => {
console.log("_DEBUG_* SessionStore final -> recordingState", session);
logger.debug('update current session');
this.updateCurrentSession(session);
//if(callback != null) {
// callback();
//}
# updateSessionInfo: `function(session, force) {
# console.log("_DEBUG_* SessionStore#updateSessionInfo", session);
# if ((force === true) || (this.currentTrackChanges < session.track_changes_counter)) {
# logger.debug("updating current track changes from %o to %o", this.currentTrackChanges, session.track_changes_counter);
# this.currentTrackChanges = session.track_changes_counter;
# this.sendClientParticipantChanges(this.currentSession, session);
# this.recordingModel.getRecordingState().then(
# (recordingState) => {
# if (recordingState) {
# //merge the recording state with the session
# console.log("_DEBUG_* SessionStore getRecordingState -> recordingState", recordingState);
# session = {...session, ...recordingState};
# }
# }
# ).finally(() => {
# console.log("_DEBUG_* SessionStore final -> recordingState", session);
# logger.debug('update current session');
# this.updateCurrentSession(session);
# //if(callback != null) {
# // callback();
# //}
})
# })
} else {
return logger.info("ignoring refresh because we already have current: " + this.currentTrackChanges + ", seen: " + session.track_changes_counter);
}
}`
# } else {
# return logger.info("ignoring refresh because we already have current: " + this.currentTrackChanges + ", seen: " + session.track_changes_counter);
# }
# }`
updateSessionInfo: `function (session, force) {
if ((force === true) || (this.currentTrackChanges < session.track_changes_counter)) {
logger.debug("updating current track changes from %o to %o", this.currentTrackChanges, session.track_changes_counter);
this.currentTrackChanges = session.track_changes_counter;
this.sendClientParticipantChanges(this.currentSession, session);
this.recordingModel.getCurrentRecordingState().then((recordingState) => {
session = { ...session, ...recordingState };
//console.log("_DEBUG_* SessionStore#recordingState", recordingState);
logger.debug('update current session');
}).finally(() => {
this.updateCurrentSession(session);
});
} else {
return logger.info("ignoring refresh because we already have current: " + this.currentTrackChanges + ", seen: " + session.track_changes_counter);
}
}`
leaveSessionRest: () ->
#alert('leaveSessionRest')