wip on leaving a session while recording

This commit is contained in:
Nuwan 2025-03-17 15:51:59 +05:30
parent eb9ad97ada
commit 76aefd6227
6 changed files with 21 additions and 11 deletions

View File

@ -145,9 +145,9 @@ module JamRuby
end
end
if music_session.is_recording?
errors.add(:music_session, ValidationMessages::CANT_JOIN_RECORDING_SESSION)
end
# if music_session.is_recording?
# errors.add(:music_session, ValidationMessages::CANT_JOIN_RECORDING_SESSION)
# end
# same logic as Search.scope_schools_together_sessions
if !self.user.is_platform_instructor

View File

@ -32,7 +32,7 @@ module JamRuby
foreign_key: :foreign_key1_id,
dependent: :destroy
validate :not_already_recording, :on => :create
#validate :not_already_recording, :on => :create
#validate :not_still_finalizing_previous, :on => :create
validate :not_playback_recording, :on => :create
validate :already_stopped_recording

View File

@ -1391,6 +1391,7 @@ ConfigureTracksActions = @ConfigureTracksActions
return this.app.notifyAlert("No Inputs Configured", $('<span>You will need to reconfigure your audio device.</span>'));
} else if (response["errors"] && response["errors"]["music_session"] && (response["errors"]["music_session"][0] === ["is currently recording"])) {
alert("Unable to Join Session", "The session is currently recording.");
leaveBehavior = {
location: "/client#/findSession",
notify: {
@ -2007,6 +2008,7 @@ ConfigureTracksActions = @ConfigureTracksActions
# @issueChange()
performLeaveSession: `async function(deferred) {
alert('SessionStore#performLeaveSession')
logger.debug("SessionModel.leaveCurrentSession()");
logger.debug("performLeaveSession: calling jamClient.LeaveSession for clientId=" + this.app.clientId);

View File

@ -115,7 +115,7 @@
}
/** Nulls can be passed for all 3 currently; that's a user request. */
function stopRecording(recordingId, reason, detail) {
function stopRecording(recordingId, reason, detail, serverStop = false) {
if(stoppingRecording) {
logger.debug("ignoring stopRecording because we are already stopping");
return;
@ -139,7 +139,13 @@
// logger.debug("preemptive stop media")
//context.jamClient.SessionStopPlay();
//}
await jamClient.StopRecording(recording.id, groupedTracks);
if(serverStop){
await jamClient.PeerStopRecording(recording.id, groupedTracks);
}else{
await jamClient.StopRecording(recording.id, groupedTracks);
}
rest.stopRecording( { "id": recording.id } )
.done(function() {
@ -203,7 +209,7 @@
}
function onServerStopRecording(recordingId) {
stopRecording(recordingId, null, null);
stopRecording(recordingId, null, null, true);
}
function handleRecordingStartResult(recordingId, result) {

View File

@ -470,6 +470,7 @@
app.notifyAlert("No Inputs Configured", $('<span>You will need to reconfigure your audio device.</span>'));
}
else if(response["errors"] && response["errors"]["music_session"] && response["errors"]["music_session"][0] == ["is currently recording"]) {
alert("session.js#sessionModel.joinSession The session is currently recording.");
promptLeave = false;
context.window.location = "/client#/findSession";
app.notify( { title: "Unable to Join Session", text: "The session is currently recording." }, null, true);

View File

@ -211,10 +211,11 @@
rest.getSession(sessionId)
.done(function(response) {
session = response;
if(session && session.recording) {
context.JK.app.notify( { title: "Unable to Join Session", text: "The session is currently recording." }, null, true);
return;
}
// if(session && session.recording) {
// alert("sessionUtils.joinSession#The session is currently recording.");
// context.JK.app.notify( { title: "Unable to Join Session", text: "The session is currently recording." }, null, true);
// return;
// }
if (session) {
if (session.can_join) {