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
This commit is contained in:
parent
9bfe54475b
commit
a1383bf730
|
@ -120,6 +120,7 @@ const WHITELISTED_KEYS = [
|
||||||
'iceTransportPolicy',
|
'iceTransportPolicy',
|
||||||
'ignoreStartMuted',
|
'ignoreStartMuted',
|
||||||
'liveStreamingEnabled',
|
'liveStreamingEnabled',
|
||||||
|
'localRecording',
|
||||||
'minParticipants',
|
'minParticipants',
|
||||||
'nick',
|
'nick',
|
||||||
'openBridgeChannel',
|
'openBridgeChannel',
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* @flow */
|
/* @flow */
|
||||||
|
|
||||||
import { createShortcutEvent, sendAnalytics } from '../analytics';
|
import { createShortcutEvent, sendAnalytics } from '../analytics';
|
||||||
import { APP_WILL_MOUNT, APP_WILL_UNMOUNT } from '../base/app';
|
import { APP_WILL_UNMOUNT } from '../base/app';
|
||||||
import { CONFERENCE_JOINED } from '../base/conference';
|
import { CONFERENCE_JOINED } from '../base/conference';
|
||||||
import { toggleDialog } from '../base/dialog';
|
import { toggleDialog } from '../base/dialog';
|
||||||
import { i18next } from '../base/i18n';
|
import { i18next } from '../base/i18n';
|
||||||
|
@ -15,29 +15,23 @@ import { LocalRecordingInfoDialog } from './components';
|
||||||
import { recordingController } from './controller';
|
import { recordingController } from './controller';
|
||||||
|
|
||||||
declare var APP: Object;
|
declare var APP: Object;
|
||||||
declare var config: Object;
|
|
||||||
|
|
||||||
const isFeatureEnabled = typeof config === 'object' && config.localRecording
|
MiddlewareRegistry.register(({ getState, dispatch }) => next => action => {
|
||||||
&& config.localRecording.enabled === true;
|
|
||||||
|
|
||||||
isFeatureEnabled
|
|
||||||
&& MiddlewareRegistry.register(({ getState, dispatch }) => next => action => {
|
|
||||||
const result = next(action);
|
const result = next(action);
|
||||||
|
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case CONFERENCE_JOINED: {
|
case CONFERENCE_JOINED: {
|
||||||
const { conference } = getState()['features/base/conference'];
|
|
||||||
const { localRecording } = getState()['features/base/config'];
|
const { localRecording } = getState()['features/base/config'];
|
||||||
|
const isLocalRecordingEnabled = Boolean(
|
||||||
|
localRecording
|
||||||
|
&& localRecording.enabled
|
||||||
|
&& typeof APP === 'object'
|
||||||
|
);
|
||||||
|
|
||||||
if (localRecording && localRecording.format) {
|
if (!isLocalRecordingEnabled) {
|
||||||
recordingController.switchFormat(localRecording.format);
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
recordingController.registerEvents(conference);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case APP_WILL_MOUNT:
|
|
||||||
|
|
||||||
// realize the delegates on recordingController, allowing the UI to
|
// realize the delegates on recordingController, allowing the UI to
|
||||||
// react to state changes in recordingController.
|
// react to state changes in recordingController.
|
||||||
recordingController.onStateChanged = isEngaged => {
|
recordingController.onStateChanged = isEngaged => {
|
||||||
|
@ -69,7 +63,17 @@ isFeatureEnabled
|
||||||
sendAnalytics(createShortcutEvent('local.recording'));
|
sendAnalytics(createShortcutEvent('local.recording'));
|
||||||
dispatch(toggleDialog(LocalRecordingInfoDialog));
|
dispatch(toggleDialog(LocalRecordingInfoDialog));
|
||||||
}, 'keyboardShortcuts.localRecording');
|
}, 'keyboardShortcuts.localRecording');
|
||||||
|
|
||||||
|
if (localRecording.format) {
|
||||||
|
recordingController.switchFormat(localRecording.format);
|
||||||
|
}
|
||||||
|
|
||||||
|
const { conference } = getState()['features/base/conference'];
|
||||||
|
|
||||||
|
recordingController.registerEvents(conference);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case APP_WILL_UNMOUNT:
|
case APP_WILL_UNMOUNT:
|
||||||
recordingController.onStateChanged = null;
|
recordingController.onStateChanged = null;
|
||||||
recordingController.onNotify = null;
|
recordingController.onNotify = null;
|
||||||
|
|
Loading…
Reference in New Issue