浏览代码

fix(prejoin): Fix join without audio

master
Vlad Piersec 4 年前
父节点
当前提交
d82bb0a89b

+ 2
- 2
react/features/base/config/actionTypes.js 查看文件

@@ -43,8 +43,8 @@ export const SET_CONFIG = 'SET_CONFIG';
43 43
  * and the passed object.
44 44
  *
45 45
  * {
46
- *     type: _UPDATE_CONFIG,
46
+ *     type: UPDATE_CONFIG,
47 47
  *     config: Object
48 48
  * }
49 49
  */
50
-export const _UPDATE_CONFIG = '_UPDATE_CONFIG';
50
+export const UPDATE_CONFIG = 'UPDATE_CONFIG';

+ 15
- 1
react/features/base/config/actions.js 查看文件

@@ -6,10 +6,24 @@ import type { Dispatch } from 'redux';
6 6
 import { addKnownDomains } from '../known-domains';
7 7
 import { parseURIString } from '../util';
8 8
 
9
-import { CONFIG_WILL_LOAD, LOAD_CONFIG_ERROR, SET_CONFIG } from './actionTypes';
9
+import { CONFIG_WILL_LOAD, LOAD_CONFIG_ERROR, SET_CONFIG, UPDATE_CONFIG } from './actionTypes';
10 10
 import { _CONFIG_STORE_PREFIX } from './constants';
11 11
 import { setConfigFromURLParams } from './functions';
12 12
 
13
+
14
+/**
15
+ * Updates the config with new options.
16
+ *
17
+ * @param {Object} config - The new options (to add).
18
+ * @returns {Function}
19
+ */
20
+export function updateConfig(config: Object) {
21
+    return {
22
+        type: UPDATE_CONFIG,
23
+        config
24
+    };
25
+}
26
+
13 27
 /**
14 28
  * Signals that the configuration (commonly known in Jitsi Meet as config.js)
15 29
  * for a specific locationURL will be loaded now.

+ 3
- 5
react/features/base/config/middleware.js 查看文件

@@ -8,7 +8,8 @@ import { addKnownDomains } from '../known-domains';
8 8
 import { MiddlewareRegistry } from '../redux';
9 9
 import { parseURIString } from '../util';
10 10
 
11
-import { _UPDATE_CONFIG, SET_CONFIG } from './actionTypes';
11
+import { SET_CONFIG } from './actionTypes';
12
+import { updateConfig } from './actions';
12 13
 import { _CONFIG_STORE_PREFIX } from './constants';
13 14
 
14 15
 /**
@@ -114,10 +115,7 @@ function _setConfig({ dispatch, getState }, next, action) {
114 115
         config.resolution = resolutionFlag;
115 116
     }
116 117
 
117
-    dispatch({
118
-        type: _UPDATE_CONFIG,
119
-        config
120
-    });
118
+    dispatch(updateConfig(config));
121 119
 
122 120
     // FIXME On Web we rely on the global 'config' variable which gets altered
123 121
     // multiple times, before it makes it to the reducer. At some point it may

+ 2
- 2
react/features/base/config/reducer.js 查看文件

@@ -4,7 +4,7 @@ import _ from 'lodash';
4 4
 
5 5
 import { equals, ReducerRegistry, set } from '../redux';
6 6
 
7
-import { _UPDATE_CONFIG, CONFIG_WILL_LOAD, LOAD_CONFIG_ERROR, SET_CONFIG } from './actionTypes';
7
+import { UPDATE_CONFIG, CONFIG_WILL_LOAD, LOAD_CONFIG_ERROR, SET_CONFIG } from './actionTypes';
8 8
 import { _cleanupConfig } from './functions';
9 9
 
10 10
 /**
@@ -50,7 +50,7 @@ const INITIAL_RN_STATE = {
50 50
 
51 51
 ReducerRegistry.register('features/base/config', (state = _getInitialState(), action) => {
52 52
     switch (action.type) {
53
-    case _UPDATE_CONFIG:
53
+    case UPDATE_CONFIG:
54 54
         return _updateConfig(state, action);
55 55
 
56 56
     case CONFIG_WILL_LOAD:

+ 8
- 3
react/features/prejoin/actions.js 查看文件

@@ -201,11 +201,13 @@ export function initPrejoin(tracks: Object[], errors: Object) {
201 201
 /**
202 202
  * Action used to start the conference.
203 203
  *
204
+ * @param {Object} options - The config options that override the default ones (if any).
204 205
  * @returns {Function}
205 206
  */
206
-export function joinConference() {
207
+export function joinConference(options?: Object) {
207 208
     return {
208
-        type: PREJOIN_START_CONFERENCE
209
+        type: PREJOIN_START_CONFERENCE,
210
+        options
209 211
     };
210 212
 }
211 213
 
@@ -222,7 +224,10 @@ export function joinConferenceWithoutAudio() {
222 224
         if (audioTrack) {
223 225
             await dispatch(replaceLocalTrack(audioTrack, null));
224 226
         }
225
-        dispatch(joinConference());
227
+
228
+        dispatch(joinConference({
229
+            startSilent: true
230
+        }));
226 231
     };
227 232
 }
228 233
 

+ 4
- 0
react/features/prejoin/middleware.js 查看文件

@@ -1,5 +1,6 @@
1 1
 // @flow
2 2
 
3
+import { updateConfig } from '../base/config';
3 4
 import { SET_AUDIO_MUTED, SET_VIDEO_MUTED } from '../base/media';
4 5
 import { MiddlewareRegistry } from '../base/redux';
5 6
 import { updateSettings } from '../base/settings';
@@ -24,6 +25,9 @@ MiddlewareRegistry.register(store => next => async action => {
24 25
         const state = getState();
25 26
         const { userSelectedSkipPrejoin } = state['features/prejoin'];
26 27
         const localVideoTrack = getLocalVideoTrack(state['features/base/tracks']);
28
+        const { options } = action;
29
+
30
+        options && store.dispatch(updateConfig(options));
27 31
 
28 32
         userSelectedSkipPrejoin && dispatch(updateSettings({
29 33
             userSelectedSkipPrejoin

正在加载...
取消
保存