|
@@ -22,6 +22,50 @@ import VideoLayout from '../videolayout/VideoLayout';
|
22
|
22
|
|
23
|
23
|
import { setToolboxEnabled } from '../../../react/features/toolbox';
|
24
|
24
|
import { setNotificationsEnabled } from '../../../react/features/notifications';
|
|
25
|
+import {
|
|
26
|
+ hideRecordingLabel,
|
|
27
|
+ updateRecordingState
|
|
28
|
+} from '../../../react/features/recording';
|
|
29
|
+
|
|
30
|
+const Status = JitsiMeetJS.constants.recordingStatus;
|
|
31
|
+
|
|
32
|
+/**
|
|
33
|
+ * Translation keys to use for display in the UI when recording the conference
|
|
34
|
+ * but not streaming live.
|
|
35
|
+ *
|
|
36
|
+ * @private
|
|
37
|
+ * @type {Object}
|
|
38
|
+ */
|
|
39
|
+export const RECORDING_TRANSLATION_KEYS = {
|
|
40
|
+ failedToStartKey: 'recording.failedToStart',
|
|
41
|
+ recordingBusy: 'liveStreaming.busy',
|
|
42
|
+ recordingButtonTooltip: 'recording.buttonTooltip',
|
|
43
|
+ recordingErrorKey: 'recording.error',
|
|
44
|
+ recordingOffKey: 'recording.off',
|
|
45
|
+ recordingOnKey: 'recording.on',
|
|
46
|
+ recordingPendingKey: 'recording.pending',
|
|
47
|
+ recordingTitle: 'dialog.recording',
|
|
48
|
+ recordingUnavailable: 'recording.unavailable'
|
|
49
|
+};
|
|
50
|
+
|
|
51
|
+/**
|
|
52
|
+ * Translation keys to use for display in the UI when the recording mode is
|
|
53
|
+ * currently streaming live.
|
|
54
|
+ *
|
|
55
|
+ * @private
|
|
56
|
+ * @type {Object}
|
|
57
|
+ */
|
|
58
|
+export const STREAMING_TRANSLATION_KEYS = {
|
|
59
|
+ failedToStartKey: 'liveStreaming.failedToStart',
|
|
60
|
+ recordingBusy: 'liveStreaming.busy',
|
|
61
|
+ recordingButtonTooltip: 'liveStreaming.buttonTooltip',
|
|
62
|
+ recordingErrorKey: 'liveStreaming.error',
|
|
63
|
+ recordingOffKey: 'liveStreaming.off',
|
|
64
|
+ recordingOnKey: 'liveStreaming.on',
|
|
65
|
+ recordingPendingKey: 'liveStreaming.pending',
|
|
66
|
+ recordingTitle: 'dialog.liveStreaming',
|
|
67
|
+ recordingUnavailable: 'liveStreaming.unavailable'
|
|
68
|
+};
|
25
|
69
|
|
26
|
70
|
/**
|
27
|
71
|
* The dialog for user input.
|
|
@@ -194,57 +238,6 @@ function _showStopRecordingPrompt(recordingType) {
|
194
|
238
|
});
|
195
|
239
|
}
|
196
|
240
|
|
197
|
|
-/**
|
198
|
|
- * Moves the element given by {selector} to the top right corner of the screen.
|
199
|
|
- * Set additional classes that can be used to style the selector relative to the
|
200
|
|
- * state of the filmstrip.
|
201
|
|
- *
|
202
|
|
- * @param selector the selector for the element to move
|
203
|
|
- * @param move {true} to move the element, {false} to move it back to its intial
|
204
|
|
- * position
|
205
|
|
- */
|
206
|
|
-function moveToCorner(selector, move) {
|
207
|
|
- let moveToCornerClass = "moveToCorner";
|
208
|
|
- let containsClass = selector.hasClass(moveToCornerClass);
|
209
|
|
-
|
210
|
|
- if (move && !containsClass)
|
211
|
|
- selector.addClass(moveToCornerClass);
|
212
|
|
- else if (!move && containsClass)
|
213
|
|
- selector.removeClass(moveToCornerClass);
|
214
|
|
-
|
215
|
|
- const {
|
216
|
|
- remoteVideosVisible,
|
217
|
|
- visible
|
218
|
|
- } = APP.store.getState()['features/filmstrip'];
|
219
|
|
- const filmstripWasHidden = selector.hasClass('without-filmstrip');
|
220
|
|
- const filmstipIsOpening = filmstripWasHidden && visible;
|
221
|
|
- selector.toggleClass('opening', filmstipIsOpening);
|
222
|
|
-
|
223
|
|
- selector.toggleClass('with-filmstrip', visible);
|
224
|
|
- selector.toggleClass('without-filmstrip', !visible);
|
225
|
|
-
|
226
|
|
- selector.toggleClass('with-remote-videos', remoteVideosVisible);
|
227
|
|
- selector.toggleClass('without-remote-videos', !remoteVideosVisible);
|
228
|
|
-}
|
229
|
|
-
|
230
|
|
-/**
|
231
|
|
- * The status of the recorder.
|
232
|
|
- * FIXME: Those constants should come from the library.
|
233
|
|
- * @type {{ON: string, OFF: string, AVAILABLE: string,
|
234
|
|
- * UNAVAILABLE: string, PENDING: string}}
|
235
|
|
- */
|
236
|
|
-var Status = {
|
237
|
|
- ON: "on",
|
238
|
|
- OFF: "off",
|
239
|
|
- AVAILABLE: "available",
|
240
|
|
- UNAVAILABLE: "unavailable",
|
241
|
|
- PENDING: "pending",
|
242
|
|
- RETRYING: "retrying",
|
243
|
|
- ERROR: "error",
|
244
|
|
- FAILED: "failed",
|
245
|
|
- BUSY: "busy"
|
246
|
|
-};
|
247
|
|
-
|
248
|
241
|
/**
|
249
|
242
|
* Checks whether if the given status is either PENDING or RETRYING
|
250
|
243
|
* @param status {Status} Jibri status to be checked
|
|
@@ -271,27 +264,11 @@ var Recording = {
|
271
|
264
|
|
272
|
265
|
if (recordingType === 'jibri') {
|
273
|
266
|
this.baseClass = "fa fa-play-circle";
|
274
|
|
- this.recordingTitle = "dialog.liveStreaming";
|
275
|
|
- this.recordingOnKey = "liveStreaming.on";
|
276
|
|
- this.recordingOffKey = "liveStreaming.off";
|
277
|
|
- this.recordingPendingKey = "liveStreaming.pending";
|
278
|
|
- this.failedToStartKey = "liveStreaming.failedToStart";
|
279
|
|
- this.recordingErrorKey = "liveStreaming.error";
|
280
|
|
- this.recordingButtonTooltip = "liveStreaming.buttonTooltip";
|
281
|
|
- this.recordingUnavailable = "liveStreaming.unavailable";
|
282
|
|
- this.recordingBusy = "liveStreaming.busy";
|
|
267
|
+ Object.assign(this, STREAMING_TRANSLATION_KEYS);
|
283
|
268
|
}
|
284
|
269
|
else {
|
285
|
270
|
this.baseClass = "icon-recEnable";
|
286
|
|
- this.recordingTitle = "dialog.recording";
|
287
|
|
- this.recordingOnKey = "recording.on";
|
288
|
|
- this.recordingOffKey = "recording.off";
|
289
|
|
- this.recordingPendingKey = "recording.pending";
|
290
|
|
- this.failedToStartKey = "recording.failedToStart";
|
291
|
|
- this.recordingErrorKey = "recording.error";
|
292
|
|
- this.recordingButtonTooltip = "recording.buttonTooltip";
|
293
|
|
- this.recordingUnavailable = "recording.unavailable";
|
294
|
|
- this.recordingBusy = "liveStreaming.busy";
|
|
271
|
+ Object.assign(this, RECORDING_TRANSLATION_KEYS);
|
295
|
272
|
}
|
296
|
273
|
|
297
|
274
|
// XXX Due to the React-ification of Toolbox, the HTMLElement with id
|
|
@@ -311,10 +288,6 @@ var Recording = {
|
311
|
288
|
APP.store.dispatch(setNotificationsEnabled(false));
|
312
|
289
|
APP.UI.messageHandler.enablePopups(false);
|
313
|
290
|
}
|
314
|
|
-
|
315
|
|
- this.eventEmitter.addListener(UIEvents.UPDATED_FILMSTRIP_DISPLAY, () =>{
|
316
|
|
- this._updateStatusLabel();
|
317
|
|
- });
|
318
|
291
|
},
|
319
|
292
|
|
320
|
293
|
/**
|
|
@@ -364,65 +337,85 @@ var Recording = {
|
364
|
337
|
let oldState = this.currentState;
|
365
|
338
|
this.currentState = recordingState;
|
366
|
339
|
|
367
|
|
- // TODO: handle recording state=available
|
368
|
|
- if (recordingState === Status.ON ||
|
369
|
|
- recordingState === Status.RETRYING) {
|
|
340
|
+ let labelDisplayConfiguration;
|
|
341
|
+
|
|
342
|
+ switch (recordingState) {
|
|
343
|
+ case Status.ON:
|
|
344
|
+ case Status.RETRYING: {
|
|
345
|
+ labelDisplayConfiguration = {
|
|
346
|
+ centered: false,
|
|
347
|
+ key: this.recordingOnKey,
|
|
348
|
+ showSpinner: recordingState === Status.RETRYING
|
|
349
|
+ };
|
370
|
350
|
|
371
|
351
|
this._setToolbarButtonToggled(true);
|
372
|
352
|
|
373
|
|
- this._updateStatusLabel(this.recordingOnKey, false);
|
|
353
|
+ break;
|
374
|
354
|
}
|
375
|
|
- else if (recordingState === Status.OFF
|
376
|
|
- || recordingState === Status.UNAVAILABLE
|
377
|
|
- || recordingState === Status.BUSY
|
378
|
|
- || recordingState === Status.FAILED) {
|
379
|
|
-
|
380
|
|
- // We don't want to do any changes if this is
|
381
|
|
- // an availability change.
|
382
|
|
- if (oldState !== Status.ON
|
383
|
|
- && !isStartingStatus(oldState))
|
384
|
|
- return;
|
385
|
355
|
|
386
|
|
- this._setToolbarButtonToggled(false);
|
|
356
|
+ case Status.OFF:
|
|
357
|
+ case Status.BUSY:
|
|
358
|
+ case Status.FAILED:
|
|
359
|
+ case Status.UNAVAILABLE: {
|
|
360
|
+ const wasInStartingStatus = isStartingStatus(oldState);
|
387
|
361
|
|
388
|
|
- let messageKey;
|
389
|
|
- if (isStartingStatus(oldState))
|
390
|
|
- messageKey = this.failedToStartKey;
|
391
|
|
- else
|
392
|
|
- messageKey = this.recordingOffKey;
|
|
362
|
+ // We don't want UI changes if this is an availability change.
|
|
363
|
+ if (oldState !== Status.ON && !wasInStartingStatus) {
|
|
364
|
+ APP.store.dispatch(updateRecordingState({ recordingState }));
|
|
365
|
+ return;
|
|
366
|
+ }
|
393
|
367
|
|
394
|
|
- this._updateStatusLabel(messageKey, true);
|
|
368
|
+ labelDisplayConfiguration = {
|
|
369
|
+ centered: true,
|
|
370
|
+ key: wasInStartingStatus
|
|
371
|
+ ? this.failedToStartKey
|
|
372
|
+ : this.recordingOffKey
|
|
373
|
+ };
|
|
374
|
+
|
|
375
|
+ this._setToolbarButtonToggled(false);
|
395
|
376
|
|
396
|
377
|
setTimeout(function(){
|
397
|
|
- $('#recordingLabel').css({display: "none"});
|
|
378
|
+ APP.store.dispatch(hideRecordingLabel());
|
398
|
379
|
}, 5000);
|
|
380
|
+
|
|
381
|
+ break;
|
399
|
382
|
}
|
400
|
|
- else if (recordingState === Status.PENDING) {
|
|
383
|
+
|
|
384
|
+ case Status.PENDING: {
|
|
385
|
+ labelDisplayConfiguration = {
|
|
386
|
+ centered: true,
|
|
387
|
+ key: this.recordingPendingKey
|
|
388
|
+ };
|
401
|
389
|
|
402
|
390
|
this._setToolbarButtonToggled(false);
|
403
|
391
|
|
404
|
|
- this._updateStatusLabel(this.recordingPendingKey, true);
|
|
392
|
+ break;
|
405
|
393
|
}
|
406
|
|
- else if (recordingState === Status.ERROR
|
407
|
|
- || recordingState === Status.FAILED) {
|
|
394
|
+
|
|
395
|
+ case Status.ERROR: {
|
|
396
|
+ labelDisplayConfiguration = {
|
|
397
|
+ centered: true,
|
|
398
|
+ key: this.recordingErrorKey
|
|
399
|
+ };
|
408
|
400
|
|
409
|
401
|
this._setToolbarButtonToggled(false);
|
410
|
402
|
|
411
|
|
- this._updateStatusLabel(this.recordingErrorKey, true);
|
|
403
|
+ break;
|
412
|
404
|
}
|
413
|
405
|
|
414
|
|
- let labelSelector = $('#recordingLabel');
|
415
|
|
-
|
416
|
|
- // We don't show the label for available state.
|
417
|
|
- if (recordingState !== Status.AVAILABLE
|
418
|
|
- && !labelSelector.is(":visible"))
|
419
|
|
- labelSelector.css({display: "inline-block"});
|
|
406
|
+ // Return an empty label display configuration to indicate no label
|
|
407
|
+ // should be displayed. The Status.AVAIABLE case is handled here.
|
|
408
|
+ default: {
|
|
409
|
+ labelDisplayConfiguration = null;
|
|
410
|
+ }
|
|
411
|
+ }
|
420
|
412
|
|
421
|
|
- // Recording spinner
|
422
|
|
- let spinnerId = 'recordingSpinner';
|
423
|
|
- UIUtil.setVisible(
|
424
|
|
- spinnerId, recordingState === Status.RETRYING);
|
|
413
|
+ APP.store.dispatch(updateRecordingState({
|
|
414
|
+ labelDisplayConfiguration,
|
|
415
|
+ recordingState
|
|
416
|
+ }));
|
425
|
417
|
},
|
|
418
|
+
|
426
|
419
|
// checks whether recording is enabled and whether we have params
|
427
|
420
|
// to start automatically recording
|
428
|
421
|
checkAutoRecord() {
|
|
@@ -432,21 +425,6 @@ var Recording = {
|
432
|
425
|
this.predefinedToken);
|
433
|
426
|
}
|
434
|
427
|
},
|
435
|
|
- /**
|
436
|
|
- * Updates the status label.
|
437
|
|
- * @param textKey the text to show
|
438
|
|
- * @param isCentered indicates if the label should be centered on the window
|
439
|
|
- * or moved to the top right corner.
|
440
|
|
- */
|
441
|
|
- _updateStatusLabel(textKey, isCentered) {
|
442
|
|
- let labelSelector = $('#recordingLabel');
|
443
|
|
- let labelTextSelector = $('#recordingLabelText');
|
444
|
|
-
|
445
|
|
- moveToCorner(labelSelector, !isCentered);
|
446
|
|
-
|
447
|
|
- labelTextSelector.attr("data-i18n", textKey);
|
448
|
|
- APP.translation.translateElement(labelSelector);
|
449
|
|
- },
|
450
|
428
|
|
451
|
429
|
/**
|
452
|
430
|
* Handles {@code click} on {@code toolbar_button_record}.
|