Merge pull request #670 from jitsi/handle-recording-errors

Handle recording errors
This commit is contained in:
hristoterezov 2016-06-02 18:18:42 -05:00
commit b8d8ef5cfd
3 changed files with 33 additions and 13 deletions

View File

@ -356,7 +356,6 @@ export default {
if(JitsiMeetJS.getGlobalOnErrorHandler){ if(JitsiMeetJS.getGlobalOnErrorHandler){
var oldOnErrorHandler = window.onerror; var oldOnErrorHandler = window.onerror;
window.onerror = function (message, source, lineno, colno, error) { window.onerror = function (message, source, lineno, colno, error) {
JitsiMeetJS.getGlobalOnErrorHandler( JitsiMeetJS.getGlobalOnErrorHandler(
message, source, lineno, colno, error); message, source, lineno, colno, error);

View File

@ -275,7 +275,8 @@
"off": "Recording stopped", "off": "Recording stopped",
"failedToStart": "Recording failed to start", "failedToStart": "Recording failed to start",
"buttonTooltip": "Start / stop recording", "buttonTooltip": "Start / stop recording",
"error": "Recording failed. Please try again." "error": "Recording failed. Please try again.",
"unavailable": "The recording service is currently unavailable. Please try again later."
}, },
"liveStreaming": "liveStreaming":
{ {
@ -286,6 +287,7 @@
"failedToStart": "Live streaming failed to start", "failedToStart": "Live streaming failed to start",
"buttonTooltip": "Start / stop live stream", "buttonTooltip": "Start / stop live stream",
"streamIdRequired": "Please fill in the stream id in order to launch the live streaming.", "streamIdRequired": "Please fill in the stream id in order to launch the live streaming.",
"error": "Live streaming failed. Please try again" "error": "Live streaming failed. Please try again.",
"busy": "All recorders are currently busy. Please try again later."
} }
} }

View File

@ -206,7 +206,9 @@ var Status = {
AVAILABLE: "available", AVAILABLE: "available",
UNAVAILABLE: "unavailable", UNAVAILABLE: "unavailable",
PENDING: "pending", PENDING: "pending",
ERROR: "error" ERROR: "error",
FAILED: "failed",
BUSY: "busy"
}; };
/** /**
@ -245,21 +247,27 @@ var Recording = {
if (recordingType === 'jibri') { if (recordingType === 'jibri') {
this.baseClass = "fa fa-play-circle"; this.baseClass = "fa fa-play-circle";
this.recordingTitle = "dialog.liveStreaming";
this.recordingOnKey = "liveStreaming.on"; this.recordingOnKey = "liveStreaming.on";
this.recordingOffKey = "liveStreaming.off"; this.recordingOffKey = "liveStreaming.off";
this.recordingPendingKey = "liveStreaming.pending"; this.recordingPendingKey = "liveStreaming.pending";
this.failedToStartKey = "liveStreaming.failedToStart"; this.failedToStartKey = "liveStreaming.failedToStart";
this.recordingErrorKey = "liveStreaming.error"; this.recordingErrorKey = "liveStreaming.error";
this.recordingButtonTooltip = "liveStreaming.buttonTooltip"; this.recordingButtonTooltip = "liveStreaming.buttonTooltip";
this.recordingUnavailable = "liveStreaming.unavailable";
this.recordingBusy = "liveStreaming.busy";
} }
else { else {
this.baseClass = "icon-recEnable"; this.baseClass = "icon-recEnable";
this.recordingTitle = "dialog.recording";
this.recordingOnKey = "recording.on"; this.recordingOnKey = "recording.on";
this.recordingOffKey = "recording.off"; this.recordingOffKey = "recording.off";
this.recordingPendingKey = "recording.pending"; this.recordingPendingKey = "recording.pending";
this.failedToStartKey = "recording.failedToStart"; this.failedToStartKey = "recording.failedToStart";
this.recordingErrorKey = "recording.error"; this.recordingErrorKey = "recording.error";
this.recordingButtonTooltip = "recording.buttonTooltip"; this.recordingButtonTooltip = "recording.buttonTooltip";
this.recordingUnavailable = "recording.unavailable";
this.recordingBusy = "liveStreaming.busy";
} }
selector.addClass(this.baseClass); selector.addClass(this.baseClass);
@ -307,10 +315,17 @@ var Recording = {
} }
break; break;
} }
case Status.BUSY: {
APP.UI.messageHandler.openMessageDialog(
self.recordingTitle,
self.recordingBusy
);
break;
}
default: { default: {
APP.UI.messageHandler.openMessageDialog( APP.UI.messageHandler.openMessageDialog(
"dialog.liveStreaming", self.recordingTitle,
"liveStreaming.unavailable" self.recordingUnavailable
); );
} }
} }
@ -352,6 +367,9 @@ var Recording = {
updateRecordingUI (recordingState) { updateRecordingUI (recordingState) {
let buttonSelector = $('#toolbar_button_record'); let buttonSelector = $('#toolbar_button_record');
let oldState = this.currentState;
this.currentState = recordingState;
// TODO: handle recording state=available // TODO: handle recording state=available
if (recordingState === Status.ON) { if (recordingState === Status.ON) {
@ -361,19 +379,21 @@ var Recording = {
this._updateStatusLabel(this.recordingOnKey, false); this._updateStatusLabel(this.recordingOnKey, false);
} }
else if (recordingState === Status.OFF 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 // We don't want to do any changes if this is
// an availability change. // an availability change.
if (this.currentState !== Status.ON if (oldState !== Status.ON
&& this.currentState !== Status.PENDING) && oldState !== Status.PENDING)
return; return;
buttonSelector.removeClass(this.baseClass + " active"); buttonSelector.removeClass(this.baseClass + " active");
buttonSelector.addClass(this.baseClass); buttonSelector.addClass(this.baseClass);
let messageKey; let messageKey;
if (this.currentState === Status.PENDING) if (oldState === Status.PENDING)
messageKey = this.failedToStartKey; messageKey = this.failedToStartKey;
else else
messageKey = this.recordingOffKey; messageKey = this.recordingOffKey;
@ -391,15 +411,14 @@ var Recording = {
this._updateStatusLabel(this.recordingPendingKey, true); this._updateStatusLabel(this.recordingPendingKey, true);
} }
else if (recordingState === Status.ERROR) { else if (recordingState === Status.ERROR
|| recordingState === Status.FAILED) {
buttonSelector.removeClass(this.baseClass + " active"); buttonSelector.removeClass(this.baseClass + " active");
buttonSelector.addClass(this.baseClass); buttonSelector.addClass(this.baseClass);
this._updateStatusLabel(this.recordingErrorKey, true); this._updateStatusLabel(this.recordingErrorKey, true);
} }
this.currentState = recordingState;
let labelSelector = $('#recordingLabel'); let labelSelector = $('#recordingLabel');
// We don't show the label for available state. // We don't show the label for available state.