|
@@ -205,7 +205,8 @@ var Status = {
|
205
|
205
|
OFF: "off",
|
206
|
206
|
AVAILABLE: "available",
|
207
|
207
|
UNAVAILABLE: "unavailable",
|
208
|
|
- PENDING: "pending"
|
|
208
|
+ PENDING: "pending",
|
|
209
|
+ ERROR: "error"
|
209
|
210
|
};
|
210
|
211
|
|
211
|
212
|
/**
|
|
@@ -248,6 +249,7 @@ var Recording = {
|
248
|
249
|
this.recordingOffKey = "liveStreaming.off";
|
249
|
250
|
this.recordingPendingKey = "liveStreaming.pending";
|
250
|
251
|
this.failedToStartKey = "liveStreaming.failedToStart";
|
|
252
|
+ this.recordingErrorKey = "liveStreaming.error";
|
251
|
253
|
this.recordingButtonTooltip = "liveStreaming.buttonTooltip";
|
252
|
254
|
}
|
253
|
255
|
else {
|
|
@@ -256,6 +258,7 @@ var Recording = {
|
256
|
258
|
this.recordingOffKey = "recording.off";
|
257
|
259
|
this.recordingPendingKey = "recording.pending";
|
258
|
260
|
this.failedToStartKey = "recording.failedToStart";
|
|
261
|
+ this.recordingErrorKey = "recording.error";
|
259
|
262
|
this.recordingButtonTooltip = "recording.buttonTooltip";
|
260
|
263
|
}
|
261
|
264
|
|
|
@@ -338,7 +341,6 @@ var Recording = {
|
338
|
341
|
*/
|
339
|
342
|
updateRecordingUI (recordingState) {
|
340
|
343
|
let buttonSelector = $('#toolbar_button_record');
|
341
|
|
- let labelSelector = $('#recordingLabel');
|
342
|
344
|
|
343
|
345
|
// TODO: handle recording state=available
|
344
|
346
|
if (recordingState === Status.ON) {
|
|
@@ -346,12 +348,10 @@ var Recording = {
|
346
|
348
|
buttonSelector.removeClass(this.baseClass);
|
347
|
349
|
buttonSelector.addClass(this.baseClass + " active");
|
348
|
350
|
|
349
|
|
- labelSelector.attr("data-i18n", this.recordingOnKey);
|
350
|
|
- moveToCorner(labelSelector, true, 3000);
|
351
|
|
- labelSelector
|
352
|
|
- .text(APP.translation.translateString(this.recordingOnKey));
|
353
|
|
- } else if (recordingState === Status.OFF
|
354
|
|
- || recordingState === Status.UNAVAILABLE) {
|
|
351
|
+ this._updateStatusLabel(this.recordingOnKey, false);
|
|
352
|
+ }
|
|
353
|
+ else if (recordingState === Status.OFF
|
|
354
|
+ || recordingState === Status.UNAVAILABLE) {
|
355
|
355
|
|
356
|
356
|
// We don't want to do any changes if this is
|
357
|
357
|
// an availability change.
|
|
@@ -362,15 +362,13 @@ var Recording = {
|
362
|
362
|
buttonSelector.removeClass(this.baseClass + " active");
|
363
|
363
|
buttonSelector.addClass(this.baseClass);
|
364
|
364
|
|
365
|
|
- moveToCorner(labelSelector, false);
|
366
|
365
|
let messageKey;
|
367
|
366
|
if (this.currentState === Status.PENDING)
|
368
|
367
|
messageKey = this.failedToStartKey;
|
369
|
368
|
else
|
370
|
369
|
messageKey = this.recordingOffKey;
|
371
|
370
|
|
372
|
|
- labelSelector.attr("data-i18n", messageKey);
|
373
|
|
- labelSelector.text(APP.translation.translateString(messageKey));
|
|
371
|
+ this._updateStatusLabel(messageKey, true);
|
374
|
372
|
|
375
|
373
|
setTimeout(function(){
|
376
|
374
|
$('#recordingLabel').css({display: "none"});
|
|
@@ -381,16 +379,19 @@ var Recording = {
|
381
|
379
|
buttonSelector.removeClass(this.baseClass + " active");
|
382
|
380
|
buttonSelector.addClass(this.baseClass);
|
383
|
381
|
|
384
|
|
- moveToCorner(labelSelector, false);
|
385
|
|
- labelSelector
|
386
|
|
- .attr("data-i18n", this.recordingPendingKey);
|
387
|
|
- labelSelector
|
388
|
|
- .text(APP.translation.translateString(
|
389
|
|
- this.recordingPendingKey));
|
|
382
|
+ this._updateStatusLabel(this.recordingPendingKey, true);
|
|
383
|
+ }
|
|
384
|
+ else if (recordingState === Status.ERROR) {
|
|
385
|
+ buttonSelector.removeClass(this.baseClass + " active");
|
|
386
|
+ buttonSelector.addClass(this.baseClass);
|
|
387
|
+
|
|
388
|
+ this._updateStatusLabel(this.recordingErrorKey, true);
|
390
|
389
|
}
|
391
|
390
|
|
392
|
391
|
this.currentState = recordingState;
|
393
|
392
|
|
|
393
|
+ let labelSelector = $('#recordingLabel');
|
|
394
|
+
|
394
|
395
|
// We don't show the label for available state.
|
395
|
396
|
if (recordingState !== Status.AVAILABLE
|
396
|
397
|
&& !labelSelector.is(":visible"))
|
|
@@ -404,6 +405,20 @@ var Recording = {
|
404
|
405
|
this.eventEmitter.emit(UIEvents.RECORDING_TOGGLED,
|
405
|
406
|
this.predefinedToken);
|
406
|
407
|
}
|
|
408
|
+ },
|
|
409
|
+ /**
|
|
410
|
+ * Updates the status label.
|
|
411
|
+ * @param textKey the text to show
|
|
412
|
+ * @param isCentered indicates if the label should be centered on the window
|
|
413
|
+ * or moved to the top right corner.
|
|
414
|
+ */
|
|
415
|
+ _updateStatusLabel(textKey, isCentered) {
|
|
416
|
+ let labelSelector = $('#recordingLabel');
|
|
417
|
+
|
|
418
|
+ moveToCorner(labelSelector, !isCentered);
|
|
419
|
+
|
|
420
|
+ labelSelector.attr("data-i18n", textKey);
|
|
421
|
+ labelSelector.text(APP.translation.translateString(textKey));
|
407
|
422
|
}
|
408
|
423
|
};
|
409
|
424
|
|