diff --git a/web/app/assets/javascripts/backend_alerts.js b/web/app/assets/javascripts/backend_alerts.js index b2ef4b7cf..5284f0281 100644 --- a/web/app/assets/javascripts/backend_alerts.js +++ b/web/app/assets/javascripts/backend_alerts.js @@ -72,7 +72,6 @@ var alertData = $.extend({}, ALERT_TYPES[type]); alertData.text = text; - if(alertData) { $document.triggerHandler(alertData.name, alertData); } @@ -121,6 +120,10 @@ if(context.JK.CurrentSessionModel) context.JK.CurrentSessionModel.onBroadcastStopped(type, text); } + else if(type === ALERT_NAMES.RECORD_PLAYBACK_STATE) { + if(context.JK.CurrentSessionModel) + context.JK.CurrentSessionModel.onPlaybackStateChange(type, text); + } else if((!context.JK.CurrentSessionModel || !context.JK.CurrentSessionModel.inSession()) && (ALERT_NAMES.INPUT_IO_RATE == type || ALERT_NAMES.INPUT_IO_JTR == type || ALERT_NAMES.OUTPUT_IO_RATE == type || ALERT_NAMES.OUTPUT_IO_JTR== type)) { // squelch these events if not in session diff --git a/web/app/assets/javascripts/playbackControls.js b/web/app/assets/javascripts/playbackControls.js index 1634150c1..aa83cfc95 100644 --- a/web/app/assets/javascripts/playbackControls.js +++ b/web/app/assets/javascripts/playbackControls.js @@ -385,11 +385,25 @@ } } + function onPlayStartEvent() { + playbackPlaying = true; + } + + function onPlayStopEvent() { + playbackPlaying = false; + } + + function onPlayPauseEvent() { + playbackPlaying = false; + } this.update = update; this.setPlaybackMode = setPlaybackMode; this.startMonitor = startMonitor; this.stopMonitor = stopMonitor; + this.onPlayStopEvent = onPlayStopEvent; + this.onPlayStartEvent = onPlayStartEvent; + this.onPlayPauseEvent = onPlayPauseEvent; return this; } diff --git a/web/app/assets/javascripts/session.js b/web/app/assets/javascripts/session.js index 79613f7ba..d7acfaaa4 100644 --- a/web/app/assets/javascripts/session.js +++ b/web/app/assets/javascripts/session.js @@ -3305,6 +3305,20 @@ promptLeave = _promptLeave; } + this.onPlaybackStateChange = function(change_type){ + // if it's play_stop or play_start, poke the playControls + + if(change_type == 'play_start') { + playbackControls.onPlayStartEvent(); + } + else if(change_type == 'play_stop'){ + playbackControls.onPlayStopEvent(); + } + else if(change_type == 'play_pause'){ + playbackControls.onPlayPauseEvent(); + } + } + context.JK.HandleVolumeChangeCallback = handleVolumeChangeCallback; context.JK.HandleMetronomeCallback = handleMetronomeCallback; context.JK.HandleBridgeCallback = handleBridgeCallback; diff --git a/web/app/assets/javascripts/sessionModel.js b/web/app/assets/javascripts/sessionModel.js index ceb4b70b6..b2f501ff2 100644 --- a/web/app/assets/javascripts/sessionModel.js +++ b/web/app/assets/javascripts/sessionModel.js @@ -799,6 +799,14 @@ } } + function onPlaybackStateChange(type, text) { + + // if text is play_start or play_stop, tell the play_controls + + if(sessionScreen) { + sessionScreen.onPlaybackStateChange(text); + } + } function onBackendMixerChanged(type, text) { logger.debug("BACKEND_MIXER_CHANGE alert. reason:" + text); @@ -909,6 +917,7 @@ this.onBroadcastStopped = onBroadcastStopped; this.onBroadcastSuccess = onBroadcastSuccess; this.onBroadcastFailure = onBroadcastFailure; + this.onPlaybackStateChange = onPlaybackStateChange; this.getCurrentSession = function() { return currentSession;