Przeglądaj źródła

Merge pull request #640 from jitsi/fix-recorder-states

Fix recorder state and moderator restart
master
Paweł Domas 9 lat temu
rodzic
commit
b191c58462
2 zmienionych plików z 19 dodań i 7 usunięć
  1. 12
    0
      conference.js
  2. 7
    7
      modules/UI/recording/Recording.js

+ 12
- 0
conference.js Wyświetl plik

460
         return this._room
460
         return this._room
461
             && this._room.myUserId();
461
             && this._room.myUserId();
462
     },
462
     },
463
+    /**
464
+     * Indicates if recording is supported in this conference.
465
+     */
466
+    isRecordingSupported() {
467
+        return this._room && this._room.isRecordingSupported();
468
+    },
469
+    /**
470
+     * Returns the recording state or undefined if the room is not defined.
471
+     */
472
+    getRecordingState() {
473
+        return (this._room) ? this._room.getRecordingState() : undefined;
474
+    },
463
     /**
475
     /**
464
      * Will be filled with values only when config.debug is enabled.
476
      * Will be filled with values only when config.debug is enabled.
465
      * Its used by torture to check audio levels.
477
      * Its used by torture to check audio levels.

+ 7
- 7
modules/UI/recording/Recording.js Wyświetl plik

30
  */
30
  */
31
 function _isRecordingButtonEnabled() {
31
 function _isRecordingButtonEnabled() {
32
     return interfaceConfig.TOOLBAR_BUTTONS.indexOf("recording") !== -1
32
     return interfaceConfig.TOOLBAR_BUTTONS.indexOf("recording") !== -1
33
-            && config.enableRecording;
33
+            && config.enableRecording && APP.conference.isRecordingSupported();
34
 }
34
 }
35
 
35
 
36
 /**
36
 /**
211
 /**
211
 /**
212
  * Manages the recording user interface and user experience.
212
  * Manages the recording user interface and user experience.
213
  * @type {{init, initRecordingButton, showRecordingButton, updateRecordingState,
213
  * @type {{init, initRecordingButton, showRecordingButton, updateRecordingState,
214
- * setRecordingButtonState, checkAutoRecord}}
214
+ * updateRecordingUI, checkAutoRecord}}
215
  */
215
  */
216
 var Recording = {
216
 var Recording = {
217
     /**
217
     /**
219
      */
219
      */
220
     init (emitter, recordingType) {
220
     init (emitter, recordingType) {
221
         this.eventEmitter = emitter;
221
         this.eventEmitter = emitter;
222
-        // Use recorder states directly from the library.
223
-        this.currentState = Status.UNAVAILABLE;
222
+
223
+        this.updateRecordingState(APP.conference.getRecordingState());
224
 
224
 
225
         this.initRecordingButton(recordingType);
225
         this.initRecordingButton(recordingType);
226
 
226
 
326
             return;
326
             return;
327
 
327
 
328
         // If there's no state change, we ignore the update.
328
         // If there's no state change, we ignore the update.
329
-        if (this.currentState === recordingState)
329
+        if (!recordingState || this.currentState === recordingState)
330
             return;
330
             return;
331
 
331
 
332
-        this.setRecordingButtonState(recordingState);
332
+        this.updateRecordingUI(recordingState);
333
     },
333
     },
334
 
334
 
335
     /**
335
     /**
336
      * Sets the state of the recording button.
336
      * Sets the state of the recording button.
337
      * @param recordingState gives us the current recording state
337
      * @param recordingState gives us the current recording state
338
      */
338
      */
339
-    setRecordingButtonState (recordingState) {
339
+    updateRecordingUI (recordingState) {
340
         let buttonSelector = $('#toolbar_button_record');
340
         let buttonSelector = $('#toolbar_button_record');
341
         let labelSelector = $('#recordingLabel');
341
         let labelSelector = $('#recordingLabel');
342
 
342
 

Ładowanie…
Anuluj
Zapisz