|
@@ -206,7 +206,9 @@ var Status = {
|
206
|
206
|
AVAILABLE: "available",
|
207
|
207
|
UNAVAILABLE: "unavailable",
|
208
|
208
|
PENDING: "pending",
|
209
|
|
- ERROR: "error"
|
|
209
|
+ ERROR: "error",
|
|
210
|
+ FAILED: "failed",
|
|
211
|
+ BUSY: "busy"
|
210
|
212
|
};
|
211
|
213
|
|
212
|
214
|
/**
|
|
@@ -245,21 +247,27 @@ var Recording = {
|
245
|
247
|
|
246
|
248
|
if (recordingType === 'jibri') {
|
247
|
249
|
this.baseClass = "fa fa-play-circle";
|
|
250
|
+ this.recordingTitle = "dialog.liveStreaming";
|
248
|
251
|
this.recordingOnKey = "liveStreaming.on";
|
249
|
252
|
this.recordingOffKey = "liveStreaming.off";
|
250
|
253
|
this.recordingPendingKey = "liveStreaming.pending";
|
251
|
254
|
this.failedToStartKey = "liveStreaming.failedToStart";
|
252
|
255
|
this.recordingErrorKey = "liveStreaming.error";
|
253
|
256
|
this.recordingButtonTooltip = "liveStreaming.buttonTooltip";
|
|
257
|
+ this.recordingUnavailable = "liveStreaming.unavailable";
|
|
258
|
+ this.recordingBusy = "liveStreaming.busy";
|
254
|
259
|
}
|
255
|
260
|
else {
|
256
|
261
|
this.baseClass = "icon-recEnable";
|
|
262
|
+ this.recordingTitle = "dialog.recording";
|
257
|
263
|
this.recordingOnKey = "recording.on";
|
258
|
264
|
this.recordingOffKey = "recording.off";
|
259
|
265
|
this.recordingPendingKey = "recording.pending";
|
260
|
266
|
this.failedToStartKey = "recording.failedToStart";
|
261
|
267
|
this.recordingErrorKey = "recording.error";
|
262
|
268
|
this.recordingButtonTooltip = "recording.buttonTooltip";
|
|
269
|
+ this.recordingUnavailable = "recording.unavailable";
|
|
270
|
+ this.recordingBusy = "liveStreaming.busy";
|
263
|
271
|
}
|
264
|
272
|
|
265
|
273
|
selector.addClass(this.baseClass);
|
|
@@ -307,10 +315,17 @@ var Recording = {
|
307
|
315
|
}
|
308
|
316
|
break;
|
309
|
317
|
}
|
|
318
|
+ case Status.BUSY: {
|
|
319
|
+ APP.UI.messageHandler.openMessageDialog(
|
|
320
|
+ self.recordingTitle,
|
|
321
|
+ self.recordingBusy
|
|
322
|
+ );
|
|
323
|
+ break;
|
|
324
|
+ }
|
310
|
325
|
default: {
|
311
|
326
|
APP.UI.messageHandler.openMessageDialog(
|
312
|
|
- "dialog.liveStreaming",
|
313
|
|
- "liveStreaming.unavailable"
|
|
327
|
+ self.recordingTitle,
|
|
328
|
+ self.recordingUnavailable
|
314
|
329
|
);
|
315
|
330
|
}
|
316
|
331
|
}
|
|
@@ -333,7 +348,7 @@ var Recording = {
|
333
|
348
|
* Updates the recording state UI.
|
334
|
349
|
* @param recordingState gives us the current recording state
|
335
|
350
|
*/
|
336
|
|
- updateRecordingState(recordingState) {
|
|
351
|
+ updateRecordingState(recordingState, error) {
|
337
|
352
|
// I'm the recorder, so I don't want to see any UI related to states.
|
338
|
353
|
if (config.iAmRecorder)
|
339
|
354
|
return;
|
|
@@ -342,16 +357,19 @@ var Recording = {
|
342
|
357
|
if (!recordingState || this.currentState === recordingState)
|
343
|
358
|
return;
|
344
|
359
|
|
345
|
|
- this.updateRecordingUI(recordingState);
|
|
360
|
+ this.updateRecordingUI(recordingState, error);
|
346
|
361
|
},
|
347
|
362
|
|
348
|
363
|
/**
|
349
|
364
|
* Sets the state of the recording button.
|
350
|
365
|
* @param recordingState gives us the current recording state
|
351
|
366
|
*/
|
352
|
|
- updateRecordingUI (recordingState) {
|
|
367
|
+ updateRecordingUI (recordingState, error) {
|
353
|
368
|
let buttonSelector = $('#toolbar_button_record');
|
354
|
369
|
|
|
370
|
+ let oldState = this.currentState;
|
|
371
|
+ this.currentState = recordingState;
|
|
372
|
+
|
355
|
373
|
// TODO: handle recording state=available
|
356
|
374
|
if (recordingState === Status.ON) {
|
357
|
375
|
|
|
@@ -361,19 +379,21 @@ var Recording = {
|
361
|
379
|
this._updateStatusLabel(this.recordingOnKey, false);
|
362
|
380
|
}
|
363
|
381
|
else if (recordingState === Status.OFF
|
364
|
|
- || recordingState === Status.UNAVAILABLE) {
|
|
382
|
+ || recordingState === Status.UNAVAILABLE
|
|
383
|
+ || recordingState === Status.BUSY
|
|
384
|
+ || recordingState === Status.FAILED) {
|
365
|
385
|
|
366
|
386
|
// We don't want to do any changes if this is
|
367
|
387
|
// an availability change.
|
368
|
|
- if (this.currentState !== Status.ON
|
369
|
|
- && this.currentState !== Status.PENDING)
|
|
388
|
+ if (oldState !== Status.ON
|
|
389
|
+ && oldState !== Status.PENDING)
|
370
|
390
|
return;
|
371
|
391
|
|
372
|
392
|
buttonSelector.removeClass(this.baseClass + " active");
|
373
|
393
|
buttonSelector.addClass(this.baseClass);
|
374
|
394
|
|
375
|
395
|
let messageKey;
|
376
|
|
- if (this.currentState === Status.PENDING)
|
|
396
|
+ if (oldState === Status.PENDING)
|
377
|
397
|
messageKey = this.failedToStartKey;
|
378
|
398
|
else
|
379
|
399
|
messageKey = this.recordingOffKey;
|
|
@@ -391,15 +411,15 @@ var Recording = {
|
391
|
411
|
|
392
|
412
|
this._updateStatusLabel(this.recordingPendingKey, true);
|
393
|
413
|
}
|
394
|
|
- else if (recordingState === Status.ERROR) {
|
|
414
|
+ else if (recordingState === Status.ERROR
|
|
415
|
+ || recordingState === Status.FAILED) {
|
395
|
416
|
buttonSelector.removeClass(this.baseClass + " active");
|
396
|
417
|
buttonSelector.addClass(this.baseClass);
|
397
|
418
|
|
398
|
419
|
this._updateStatusLabel(this.recordingErrorKey, true);
|
|
420
|
+ console.log("Recording failed for the following reason: ", error);
|
399
|
421
|
}
|
400
|
422
|
|
401
|
|
- this.currentState = recordingState;
|
402
|
|
-
|
403
|
423
|
let labelSelector = $('#recordingLabel');
|
404
|
424
|
|
405
|
425
|
// We don't show the label for available state.
|