|
@@ -201,10 +201,11 @@ function _showStopRecordingPrompt (recordingType) {
|
201
|
201
|
*/
|
202
|
202
|
function moveToCorner(selector, move) {
|
203
|
203
|
let moveToCornerClass = "moveToCorner";
|
|
204
|
+ let containsClass = selector.hasClass(moveToCornerClass);
|
204
|
205
|
|
205
|
|
- if (move && !selector.hasClass(moveToCornerClass))
|
|
206
|
+ if (move && !containsClass)
|
206
|
207
|
selector.addClass(moveToCornerClass);
|
207
|
|
- else
|
|
208
|
+ else if (!move && containsClass)
|
208
|
209
|
selector.removeClass(moveToCornerClass);
|
209
|
210
|
}
|
210
|
211
|
|
|
@@ -220,11 +221,21 @@ var Status = {
|
220
|
221
|
AVAILABLE: "available",
|
221
|
222
|
UNAVAILABLE: "unavailable",
|
222
|
223
|
PENDING: "pending",
|
|
224
|
+ RETRYING: "retrying",
|
223
|
225
|
ERROR: "error",
|
224
|
226
|
FAILED: "failed",
|
225
|
227
|
BUSY: "busy"
|
226
|
228
|
};
|
227
|
229
|
|
|
230
|
+/**
|
|
231
|
+ * Checks whether if the given status is either PENDING or RETRYING
|
|
232
|
+ * @param status {Status} Jibri status to be checked
|
|
233
|
+ * @returns {boolean} true if the condition is met or false otherwise.
|
|
234
|
+ */
|
|
235
|
+function isStartingStatus(status) {
|
|
236
|
+ return status === Status.PENDING || status === Status.RETRYING;
|
|
237
|
+}
|
|
238
|
+
|
228
|
239
|
/**
|
229
|
240
|
* Manages the recording user interface and user experience.
|
230
|
241
|
* @type {{init, initRecordingButton, showRecordingButton, updateRecordingState,
|
|
@@ -298,6 +309,7 @@ var Recording = {
|
298
|
309
|
|
299
|
310
|
switch (self.currentState) {
|
300
|
311
|
case Status.ON:
|
|
312
|
+ case Status.RETRYING:
|
301
|
313
|
case Status.PENDING: {
|
302
|
314
|
_showStopRecordingPrompt(recordingType).then(() =>
|
303
|
315
|
self.eventEmitter.emit(UIEvents.RECORDING_TOGGLED),
|
|
@@ -399,7 +411,8 @@ var Recording = {
|
399
|
411
|
this.currentState = recordingState;
|
400
|
412
|
|
401
|
413
|
// TODO: handle recording state=available
|
402
|
|
- if (recordingState === Status.ON) {
|
|
414
|
+ if (recordingState === Status.ON ||
|
|
415
|
+ recordingState === Status.RETRYING) {
|
403
|
416
|
|
404
|
417
|
buttonSelector.removeClass(this.baseClass);
|
405
|
418
|
buttonSelector.addClass(this.baseClass + " active");
|
|
@@ -414,14 +427,14 @@ var Recording = {
|
414
|
427
|
// We don't want to do any changes if this is
|
415
|
428
|
// an availability change.
|
416
|
429
|
if (oldState !== Status.ON
|
417
|
|
- && oldState !== Status.PENDING)
|
|
430
|
+ && !isStartingStatus(oldState))
|
418
|
431
|
return;
|
419
|
432
|
|
420
|
433
|
buttonSelector.removeClass(this.baseClass + " active");
|
421
|
434
|
buttonSelector.addClass(this.baseClass);
|
422
|
435
|
|
423
|
436
|
let messageKey;
|
424
|
|
- if (oldState === Status.PENDING)
|
|
437
|
+ if (isStartingStatus(oldState))
|
425
|
438
|
messageKey = this.failedToStartKey;
|
426
|
439
|
else
|
427
|
440
|
messageKey = this.recordingOffKey;
|
|
@@ -453,6 +466,12 @@ var Recording = {
|
453
|
466
|
if (recordingState !== Status.AVAILABLE
|
454
|
467
|
&& !labelSelector.is(":visible"))
|
455
|
468
|
labelSelector.css({display: "inline-block"});
|
|
469
|
+
|
|
470
|
+ // Recording spinner
|
|
471
|
+ if (recordingState === Status.RETRYING)
|
|
472
|
+ $("#recordingSpinner").show();
|
|
473
|
+ else
|
|
474
|
+ $("#recordingSpinner").hide();
|
456
|
475
|
},
|
457
|
476
|
// checks whether recording is enabled and whether we have params
|
458
|
477
|
// to start automatically recording
|
|
@@ -471,11 +490,12 @@ var Recording = {
|
471
|
490
|
*/
|
472
|
491
|
_updateStatusLabel(textKey, isCentered) {
|
473
|
492
|
let labelSelector = $('#recordingLabel');
|
|
493
|
+ let labelTextSelector = $('#recordingLabelText');
|
474
|
494
|
|
475
|
495
|
moveToCorner(labelSelector, !isCentered);
|
476
|
496
|
|
477
|
|
- labelSelector.attr("data-i18n", textKey);
|
478
|
|
- labelSelector.text(APP.translation.translateString(textKey));
|
|
497
|
+ labelTextSelector.attr("data-i18n", textKey);
|
|
498
|
+ labelTextSelector.text(APP.translation.translateString(textKey));
|
479
|
499
|
}
|
480
|
500
|
};
|
481
|
501
|
|