|
|
|
@ -206,7 +206,9 @@ var Status = { |
|
|
|
|
AVAILABLE: "available", |
|
|
|
|
UNAVAILABLE: "unavailable", |
|
|
|
|
PENDING: "pending", |
|
|
|
|
ERROR: "error" |
|
|
|
|
ERROR: "error", |
|
|
|
|
FAILED: "failed", |
|
|
|
|
BUSY: "busy" |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -245,21 +247,27 @@ var Recording = { |
|
|
|
|
|
|
|
|
|
if (recordingType === 'jibri') { |
|
|
|
|
this.baseClass = "fa fa-play-circle"; |
|
|
|
|
this.recordingTitle = "dialog.liveStreaming"; |
|
|
|
|
this.recordingOnKey = "liveStreaming.on"; |
|
|
|
|
this.recordingOffKey = "liveStreaming.off"; |
|
|
|
|
this.recordingPendingKey = "liveStreaming.pending"; |
|
|
|
|
this.failedToStartKey = "liveStreaming.failedToStart"; |
|
|
|
|
this.recordingErrorKey = "liveStreaming.error"; |
|
|
|
|
this.recordingButtonTooltip = "liveStreaming.buttonTooltip"; |
|
|
|
|
this.recordingUnavailable = "liveStreaming.unavailable"; |
|
|
|
|
this.recordingBusy = "liveStreaming.busy"; |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
this.baseClass = "icon-recEnable"; |
|
|
|
|
this.recordingTitle = "dialog.recording"; |
|
|
|
|
this.recordingOnKey = "recording.on"; |
|
|
|
|
this.recordingOffKey = "recording.off"; |
|
|
|
|
this.recordingPendingKey = "recording.pending"; |
|
|
|
|
this.failedToStartKey = "recording.failedToStart"; |
|
|
|
|
this.recordingErrorKey = "recording.error"; |
|
|
|
|
this.recordingButtonTooltip = "recording.buttonTooltip"; |
|
|
|
|
this.recordingUnavailable = "recording.unavailable"; |
|
|
|
|
this.recordingBusy = "liveStreaming.busy"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
selector.addClass(this.baseClass); |
|
|
|
@ -307,10 +315,17 @@ var Recording = { |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
case Status.BUSY: { |
|
|
|
|
APP.UI.messageHandler.openMessageDialog( |
|
|
|
|
self.recordingTitle, |
|
|
|
|
self.recordingBusy |
|
|
|
|
); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
default: { |
|
|
|
|
APP.UI.messageHandler.openMessageDialog( |
|
|
|
|
"dialog.liveStreaming", |
|
|
|
|
"liveStreaming.unavailable" |
|
|
|
|
self.recordingTitle, |
|
|
|
|
self.recordingUnavailable |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -333,7 +348,7 @@ var Recording = { |
|
|
|
|
* Updates the recording state UI. |
|
|
|
|
* @param recordingState gives us the current recording state |
|
|
|
|
*/ |
|
|
|
|
updateRecordingState(recordingState) { |
|
|
|
|
updateRecordingState(recordingState, error) { |
|
|
|
|
// I'm the recorder, so I don't want to see any UI related to states.
|
|
|
|
|
if (config.iAmRecorder) |
|
|
|
|
return; |
|
|
|
@ -342,16 +357,19 @@ var Recording = { |
|
|
|
|
if (!recordingState || this.currentState === recordingState) |
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
this.updateRecordingUI(recordingState); |
|
|
|
|
this.updateRecordingUI(recordingState, error); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Sets the state of the recording button. |
|
|
|
|
* @param recordingState gives us the current recording state |
|
|
|
|
*/ |
|
|
|
|
updateRecordingUI (recordingState) { |
|
|
|
|
updateRecordingUI (recordingState, error) { |
|
|
|
|
let buttonSelector = $('#toolbar_button_record'); |
|
|
|
|
|
|
|
|
|
let oldState = this.currentState; |
|
|
|
|
this.currentState = recordingState; |
|
|
|
|
|
|
|
|
|
// TODO: handle recording state=available
|
|
|
|
|
if (recordingState === Status.ON) { |
|
|
|
|
|
|
|
|
@ -361,19 +379,21 @@ var Recording = { |
|
|
|
|
this._updateStatusLabel(this.recordingOnKey, false); |
|
|
|
|
} |
|
|
|
|
else if (recordingState === Status.OFF |
|
|
|
|
|| recordingState === Status.UNAVAILABLE) { |
|
|
|
|
|| recordingState === Status.UNAVAILABLE |
|
|
|
|
|| recordingState === Status.BUSY |
|
|
|
|
|| recordingState === Status.FAILED) { |
|
|
|
|
|
|
|
|
|
// We don't want to do any changes if this is
|
|
|
|
|
// an availability change.
|
|
|
|
|
if (this.currentState !== Status.ON |
|
|
|
|
&& this.currentState !== Status.PENDING) |
|
|
|
|
if (oldState !== Status.ON |
|
|
|
|
&& oldState !== Status.PENDING) |
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
buttonSelector.removeClass(this.baseClass + " active"); |
|
|
|
|
buttonSelector.addClass(this.baseClass); |
|
|
|
|
|
|
|
|
|
let messageKey; |
|
|
|
|
if (this.currentState === Status.PENDING) |
|
|
|
|
if (oldState === Status.PENDING) |
|
|
|
|
messageKey = this.failedToStartKey; |
|
|
|
|
else |
|
|
|
|
messageKey = this.recordingOffKey; |
|
|
|
@ -391,15 +411,15 @@ var Recording = { |
|
|
|
|
|
|
|
|
|
this._updateStatusLabel(this.recordingPendingKey, true); |
|
|
|
|
} |
|
|
|
|
else if (recordingState === Status.ERROR) { |
|
|
|
|
else if (recordingState === Status.ERROR |
|
|
|
|
|| recordingState === Status.FAILED) { |
|
|
|
|
buttonSelector.removeClass(this.baseClass + " active"); |
|
|
|
|
buttonSelector.addClass(this.baseClass); |
|
|
|
|
|
|
|
|
|
this._updateStatusLabel(this.recordingErrorKey, true); |
|
|
|
|
console.log("Recording failed for the following reason: ", error); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
this.currentState = recordingState; |
|
|
|
|
|
|
|
|
|
let labelSelector = $('#recordingLabel'); |
|
|
|
|
|
|
|
|
|
// We don't show the label for available state.
|
|
|
|
|