Ver código fonte

fix(local-recording): allow config override to enable (#3615)

* fix(local-recording): allow config override to enable

Config overrides are not set until some time after
APP_WILL_MOUNT has completed and not in the same execution
context as when APP_WILL_MOUNT is called. So instead
choose recording controller initialization at a later time.
The time chosen is after conference join because the
controller needs the conference instance to work.

* remove redundant conditional check
master
virtuacoplenny 6 anos atrás
pai
commit
a1383bf730
Nenhuma conta vinculada ao e-mail do autor do commit

+ 1
- 0
react/features/base/config/functions.js Ver arquivo

@@ -120,6 +120,7 @@ const WHITELISTED_KEYS = [
120 120
     'iceTransportPolicy',
121 121
     'ignoreStartMuted',
122 122
     'liveStreamingEnabled',
123
+    'localRecording',
123 124
     'minParticipants',
124 125
     'nick',
125 126
     'openBridgeChannel',

+ 19
- 15
react/features/local-recording/middleware.js Ver arquivo

@@ -1,7 +1,7 @@
1 1
 /* @flow */
2 2
 
3 3
 import { createShortcutEvent, sendAnalytics } from '../analytics';
4
-import { APP_WILL_MOUNT, APP_WILL_UNMOUNT } from '../base/app';
4
+import { APP_WILL_UNMOUNT } from '../base/app';
5 5
 import { CONFERENCE_JOINED } from '../base/conference';
6 6
 import { toggleDialog } from '../base/dialog';
7 7
 import { i18next } from '../base/i18n';
@@ -15,29 +15,23 @@ import { LocalRecordingInfoDialog } from './components';
15 15
 import { recordingController } from './controller';
16 16
 
17 17
 declare var APP: Object;
18
-declare var config: Object;
19 18
 
20
-const isFeatureEnabled = typeof config === 'object' && config.localRecording
21
-    && config.localRecording.enabled === true;
22
-
23
-isFeatureEnabled
24
-&& MiddlewareRegistry.register(({ getState, dispatch }) => next => action => {
19
+MiddlewareRegistry.register(({ getState, dispatch }) => next => action => {
25 20
     const result = next(action);
26 21
 
27 22
     switch (action.type) {
28 23
     case CONFERENCE_JOINED: {
29
-        const { conference } = getState()['features/base/conference'];
30 24
         const { localRecording } = getState()['features/base/config'];
25
+        const isLocalRecordingEnabled = Boolean(
26
+            localRecording
27
+            && localRecording.enabled
28
+            && typeof APP === 'object'
29
+        );
31 30
 
32
-        if (localRecording && localRecording.format) {
33
-            recordingController.switchFormat(localRecording.format);
31
+        if (!isLocalRecordingEnabled) {
32
+            break;
34 33
         }
35 34
 
36
-        recordingController.registerEvents(conference);
37
-        break;
38
-    }
39
-    case APP_WILL_MOUNT:
40
-
41 35
         // realize the delegates on recordingController, allowing the UI to
42 36
         // react to state changes in recordingController.
43 37
         recordingController.onStateChanged = isEngaged => {
@@ -69,7 +63,17 @@ isFeatureEnabled
69 63
                 sendAnalytics(createShortcutEvent('local.recording'));
70 64
                 dispatch(toggleDialog(LocalRecordingInfoDialog));
71 65
             }, 'keyboardShortcuts.localRecording');
66
+
67
+        if (localRecording.format) {
68
+            recordingController.switchFormat(localRecording.format);
69
+        }
70
+
71
+        const { conference } = getState()['features/base/conference'];
72
+
73
+        recordingController.registerEvents(conference);
74
+
72 75
         break;
76
+    }
73 77
     case APP_WILL_UNMOUNT:
74 78
         recordingController.onStateChanged = null;
75 79
         recordingController.onNotify = null;

Carregando…
Cancelar
Salvar