diff --git a/ruby/lib/jam_ruby/connection_manager.rb b/ruby/lib/jam_ruby/connection_manager.rb
index 1e2114457..54f8549a9 100644
--- a/ruby/lib/jam_ruby/connection_manager.rb
+++ b/ruby/lib/jam_ruby/connection_manager.rb
@@ -478,6 +478,7 @@ SQL
end
if tracks_changed
+ music_session.active_music_session.tick_track_changes
Notification.send_tracks_changed(music_session.active_music_session)
end
@@ -529,6 +530,7 @@ SQL
end
if send_tracks_changed
+ music_session.active_music_session.tick_track_changes
Notification.send_tracks_changed(music_session.active_music_session)
end
end
diff --git a/web/app/assets/javascripts/asyncJamClient.js b/web/app/assets/javascripts/asyncJamClient.js
index ebf8c9b81..6624c36ee 100644
--- a/web/app/assets/javascripts/asyncJamClient.js
+++ b/web/app/assets/javascripts/asyncJamClient.js
@@ -427,6 +427,7 @@
GetAudioRecordingPreference: enumAppCounter++,
PeerStopRecording: enumAppCounter++,
FrontStopRecording: enumAppCounter++,
+ GetCurrentRecordingId: enumAppCounter++,
});
function setupWebSocketConnection() {
diff --git a/web/app/assets/javascripts/react-components/SessionRecordBtn.js.jsx.coffee b/web/app/assets/javascripts/react-components/SessionRecordBtn.js.jsx.coffee
index 8d5b384b3..ede206b34 100644
--- a/web/app/assets/javascripts/react-components/SessionRecordBtn.js.jsx.coffee
+++ b/web/app/assets/javascripts/react-components/SessionRecordBtn.js.jsx.coffee
@@ -9,9 +9,9 @@ AppStore = context.AppStore
onAppInit: (@app) ->
onSessionMixerChange: (sessionMixers) ->
- console.log("_DEBUG_ SessionRecordBtn onSessionMixerChange", sessionMixers)
+ console.log("_DEBUG_* SessionRecordBtn onSessionMixerChange", sessionMixers.session)
@setState({isRecording: sessionMixers.session.isRecording})
- @setState({isRecordingInitiator: sessionMixers.session.recordingClinetId && sessionMixers.session.recordingClinetId == @app.clientId})
+ @setState({isRecordingOwner: sessionMixers.session.recordingClinetId == @app.clientId})
getInitialState: () ->
{childWindow: null, isRecording: false}
@@ -25,7 +25,7 @@ AppStore = context.AppStore
return 'noclose'
handleClick: () ->
- if @state.isRecording && @state.isRecordingInitiator
+ if @state.isRecording && @state.isRecordingOwner
RecordingActions.stopRecording()
else
@openRecording()
@@ -53,7 +53,7 @@ AppStore = context.AppStore
btnStyles = "session-record session-record-btn left"
if this.state.isRecording
- if this.state.isRecordingInitiator
+ if this.state.isRecordingOwner
btnStyles = btnStyles+' button-orange'
`
@@ -63,7 +63,7 @@ AppStore = context.AppStore
btnStyles = btnStyles+' button-grey'
`
- RECORDING INPROGRESS
+ RECORDING IN-PROGRESS
`
else
btnStyles = btnStyles+' button-grey'
diff --git a/web/app/assets/javascripts/react-components/stores/SessionStore.js.coffee b/web/app/assets/javascripts/react-components/stores/SessionStore.js.coffee
index b7826dcb5..7565c223e 100644
--- a/web/app/assets/javascripts/react-components/stores/SessionStore.js.coffee
+++ b/web/app/assets/javascripts/react-components/stores/SessionStore.js.coffee
@@ -1616,18 +1616,49 @@ ConfigureTracksActions = @ConfigureTracksActions
onUpdateSession: (session) ->
@updateSessionInfo(session, true)
- updateSessionInfo: (session, force) ->
- if force == true || @currentTrackChanges < session.track_changes_counter
- logger.debug("updating current track changes from %o to %o", @currentTrackChanges, session.track_changes_counter)
- @currentTrackChanges = session.track_changes_counter
- @sendClientParticipantChanges(@currentSession, session)
- logger.debug('update current session')
- @updateCurrentSession(session);
- #if(callback != null) {
- # callback();
- #}
- else
- logger.info("ignoring refresh because we already have current: " + @currentTrackChanges + ", seen: " + session.track_changes_counter);
+ # updateSessionInfo: (session, force) ->
+ # console.log("_DEBUG_* SessionStore#updateSessionInfo", session)
+ # if force == true || @currentTrackChanges < session.track_changes_counter
+ # logger.debug("updating current track changes from %o to %o", @currentTrackChanges, session.track_changes_counter)
+ # @currentTrackChanges = session.track_changes_counter
+ # @sendClientParticipantChanges(@currentSession, session)
+ # console.log("_DEBUG_* recordingState", recordingState);
+ # logger.debug('update current session')
+ # @updateCurrentSession(session);
+ # #if(callback != null) {
+ # # callback();
+ # #}
+ # 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();
+ //}
+
+ })
+
+ } else {
+ return logger.info("ignoring refresh because we already have current: " + this.currentTrackChanges + ", seen: " + session.track_changes_counter);
+ }
+ }`
leaveSessionRest: () ->
@@ -1769,6 +1800,7 @@ ConfigureTracksActions = @ConfigureTracksActions
# @issueChange()
updateCurrentSession: `async function(sessionData) {
+ console.log("_DEBUG_* SessionStore#updateCurrentSession", sessionData)
if (sessionData !== null) {
let until_time;
this.currentOrLastSession = sessionData;
diff --git a/web/app/assets/javascripts/recordingModel.js b/web/app/assets/javascripts/recordingModel.js
index 1c0b33e48..1412a1f5e 100644
--- a/web/app/assets/javascripts/recordingModel.js
+++ b/web/app/assets/javascripts/recordingModel.js
@@ -213,12 +213,11 @@
stopRecording(recordingId, null, null);
}
- function handleRecordingStartResult(recordingId, result) {
-
+ async function handleRecordingStartResult(recordingId, result) {
+ //console.log("_DEBUG_* handleRecordingStartResult", recordingId, result)
var success = result.success;
var reason = result.reason;
- var detail = result.detail;
-
+ var detail = result.detail
if(success) {
var details = {clientId: app.clientId, isRecording:true}
@@ -235,7 +234,7 @@
}
function handleRecordingStopResult(recordingId, result) {
-
+ //console.log("_DEBUG_* handleRecordingStopResult", recordingId, result)
var success = result.success;
var reason = result.reason;
var detail = result.detail;
@@ -255,6 +254,7 @@
}
function handleRecordingStarted(recordingId, result, clientId) {
+ console.log("_DEBUG_* handleRecordingStarted", recordingId, result)
var success = result.success;
var reason = result.reason;
var detail = result.detail;
@@ -281,7 +281,26 @@
context.RecordingActions.startedRecording(details)
}
- function handleRecordingStopped(recordingId, result) {
+ async function handleRecordingStopped(recordingId, result) {
+ console.log("_DEBUG_* handleRecordingStopped", recordingId, result, $self)
+ // var recordState = await $self.getRecordingState();
+ // console.log("_DEBUG_* handleRecordingStopped -> recordState", recordState);
+ var session;
+ try{
+ session = context.SessionStore.getCurrentOrLastSession();
+ }catch(e){
+ console.error("_DEBUG_* Error getting session", e);
+ }
+
+ console.log("_DEBUG_* handleRecordingStopped -> session", session);
+ if(session) {
+ context.SessionStore.updateSessionInfo(session)
+ }
+
+ // if(recordState.isRecording) {
+ // //we are still recording, so don't stop
+ // return;
+ // }
if(recordingId == "video") {
// comes from VideoRecordingStopped
@@ -334,7 +353,7 @@
}
function handleRecordingAborted(recordingId, result) {
-
+ //console.log("_DEBUG_* handleRecordingAborted", recordingId, result)
if(recordingId == "video") {
// comes from AbortedVideoRecording
@@ -401,6 +420,28 @@
}
+ /**
+ * sync recording state with the client back end
+ */
+ async function getRecordingState() {
+ var isRecording = false;
+ var recordingClientId = null;
+ var currentRecId = await jamClient.GetCurrentRecordingId(); //if this passes recording Id it means there is an ongoing recording
+ //var currentRecId = currentRecordingId
+ console.log("_DEBUG_* getRecordingState", currentRecId)
+ if(currentRecId && currentRecId !== '') {
+ var recording = await rest.getRecordingPromise({id: currentRecId})
+ if(recording) {
+ isRecording = true;
+ recordingClientId = recording.client_id;
+ }
+ } else {
+ isRecording = false;
+ recordingClientId = null;
+ }
+ return { isRecording: isRecording, recordingClientId: recordingClientId };
+ }
+
this.initialize = function() {
};
@@ -411,6 +452,7 @@
this.reset = reset;
this.stopRecordingIfNeeded = stopRecordingIfNeeded;
this.currentOrLastRecordingId = function () { return currentOrLastRecordingId; };
+ this.getRecordingState = getRecordingState;
context.JK.HandleRecordingStartResult = handleRecordingStartResult;
context.JK.HandleRecordingStopResult = handleRecordingStopResult;
diff --git a/web/app/assets/javascripts/sessionModel.js b/web/app/assets/javascripts/sessionModel.js
index d5d4f4858..d7aa1b757 100644
--- a/web/app/assets/javascripts/sessionModel.js
+++ b/web/app/assets/javascripts/sessionModel.js
@@ -409,6 +409,7 @@
// you should only update currentSession with this function
function updateCurrentSession(sessionData) {
+ console.log("_DEBUG_* sessionModel#updateCurrentSession", sessionData)
if(sessionData != null) {
currentOrLastSession = sessionData;
}
@@ -428,10 +429,12 @@
}
function updateSessionInfo(response, callback, force) {
+ console.log("_DEBUG_* sessionModel#updateSessionInfo", response)
if(force === true || currentTrackChanges < response.track_changes_counter) {
logger.debug("updating current track changes from %o to %o", currentTrackChanges, response.track_changes_counter)
currentTrackChanges = response.track_changes_counter;
sendClientParticipantChanges(currentSession, response);
+
updateCurrentSession(response);
if(callback != null) {
callback();