ソースを参照

fix(conference): start muted values on initial GUM

Take into account the start muted values stored in local storage.
master
Hristo Terezov 4年前
コミット
9c10ac3028
3個のファイルの変更48行の追加33行の削除
  1. 4
    2
      conference.js
  2. 41
    0
      react/features/base/media/functions.js
  3. 3
    31
      react/features/base/media/middleware.js

+ 4
- 2
conference.js ファイルの表示

@@ -65,6 +65,8 @@ import {
65 65
     JitsiTrackEvents
66 66
 } from './react/features/base/lib-jitsi-meet';
67 67
 import {
68
+    getStartWithAudioMuted,
69
+    getStartWithVideoMuted,
68 70
     isVideoMutedByUser,
69 71
     MEDIA_TYPE,
70 72
     setAudioAvailable,
@@ -731,10 +733,10 @@ export default {
731 733
         const initialOptions = {
732 734
             startAudioOnly: config.startAudioOnly,
733 735
             startScreenSharing: config.startScreenSharing,
734
-            startWithAudioMuted: config.startWithAudioMuted
736
+            startWithAudioMuted: getStartWithAudioMuted(APP.store.getState())
735 737
                 || config.startSilent
736 738
                 || isUserInteractionRequiredForUnmute(APP.store.getState()),
737
-            startWithVideoMuted: config.startWithVideoMuted
739
+            startWithVideoMuted: getStartWithVideoMuted(APP.store.getState())
738 740
                 || isUserInteractionRequiredForUnmute(APP.store.getState())
739 741
         };
740 742
 

+ 41
- 0
react/features/base/media/functions.js ファイルの表示

@@ -1,9 +1,30 @@
1 1
 /* @flow */
2 2
 
3 3
 import { toState } from '../redux';
4
+import { getPropertyValue } from '../settings';
4 5
 
5 6
 import { VIDEO_MUTISM_AUTHORITY } from './constants';
6 7
 
8
+
9
+// XXX The configurations/preferences/settings startWithAudioMuted and startWithVideoMuted were introduced for
10
+// conferences/meetings. So it makes sense for these to not be considered outside of conferences/meetings
11
+// (e.g. WelcomePage). Later on, though, we introduced a "Video <-> Voice" toggle on the WelcomePage which utilizes
12
+// startAudioOnly outside of conferences/meetings so that particular configuration/preference/setting employs slightly
13
+// exclusive logic.
14
+const START_WITH_AUDIO_VIDEO_MUTED_SOURCES = {
15
+    // We have startWithAudioMuted and startWithVideoMuted here:
16
+    config: true,
17
+    settings: true,
18
+
19
+    // XXX We've already overwritten base/config with urlParams. However,
20
+    // settings are more important than the server-side config.
21
+    // Consequently, we need to read from urlParams anyway:
22
+    urlParams: true,
23
+
24
+    // We don't have startWithAudioMuted and startWithVideoMuted here:
25
+    jwt: false
26
+};
27
+
7 28
 /**
8 29
  * Determines whether audio is currently muted.
9 30
  *
@@ -47,6 +68,26 @@ function _isVideoMutedByAuthority(
47 68
     return Boolean(muted & videoMutismAuthority);
48 69
 }
49 70
 
71
+/**
72
+ * Computes the startWithAudioMuted by retrieving its values from config, URL and settings.
73
+ *
74
+ * @param {Object|Function} stateful - The redux state object or {@code getState} function.
75
+ * @returns {boolean} - The computed startWithAudioMuted value that will be used.
76
+ */
77
+export function getStartWithAudioMuted(stateful: Object | Function) {
78
+    return Boolean(getPropertyValue(stateful, 'startWithAudioMuted', START_WITH_AUDIO_VIDEO_MUTED_SOURCES));
79
+}
80
+
81
+/**
82
+ * Computes the startWithAudioMuted by retrieving its values from config, URL and settings.
83
+ *
84
+ * @param {Object|Function} stateful - The redux state object or {@code getState} function.
85
+ * @returns {boolean} - The computed startWithAudioMuted value that will be used.
86
+ */
87
+export function getStartWithVideoMuted(stateful: Object | Function) {
88
+    return Boolean(getPropertyValue(stateful, 'startWithVideoMuted', START_WITH_AUDIO_VIDEO_MUTED_SOURCES));
89
+}
90
+
50 91
 /**
51 92
  * Determines whether video is currently muted by the user authority.
52 93
  *

+ 3
- 31
react/features/base/media/middleware.js ファイルの表示

@@ -21,6 +21,7 @@ import {
21 21
     MEDIA_TYPE,
22 22
     VIDEO_MUTISM_AUTHORITY
23 23
 } from './constants';
24
+import { getStartWithAudioMuted, getStartWithVideoMuted } from './functions';
24 25
 import logger from './logger';
25 26
 import {
26 27
     _AUDIO_INITIAL_MEDIA_STATE,
@@ -133,37 +134,8 @@ function _setRoom({ dispatch, getState }, next, action) {
133 134
     const state = getState();
134 135
     const { room } = action;
135 136
     const roomIsValid = isRoomValid(room);
136
-
137
-    // XXX The configurations/preferences/settings startWithAudioMuted,
138
-    // startWithVideoMuted, and startAudioOnly were introduced for
139
-    // conferences/meetings. So it makes sense for these to not be considered
140
-    // outside of conferences/meetings (e.g. WelcomePage). Later on, though, we
141
-    // introduced a "Video <-> Voice" toggle on the WelcomePage which utilizes
142
-    // startAudioOnly outside of conferences/meetings so that particular
143
-    // configuration/preference/setting employs slightly exclusive logic.
144
-    const mutedSources = {
145
-        // We have startWithAudioMuted and startWithVideoMuted here:
146
-        config: true,
147
-        settings: true,
148
-
149
-        // XXX We've already overwritten base/config with urlParams. However,
150
-        // settings are more important than the server-side config.
151
-        // Consequently, we need to read from urlParams anyway:
152
-        urlParams: true,
153
-
154
-        // We don't have startWithAudioMuted and startWithVideoMuted here:
155
-        jwt: false
156
-    };
157
-    const audioMuted
158
-        = roomIsValid
159
-            ? Boolean(
160
-                getPropertyValue(state, 'startWithAudioMuted', mutedSources))
161
-            : _AUDIO_INITIAL_MEDIA_STATE.muted;
162
-    const videoMuted
163
-        = roomIsValid
164
-            ? Boolean(
165
-                getPropertyValue(state, 'startWithVideoMuted', mutedSources))
166
-            : _VIDEO_INITIAL_MEDIA_STATE.muted;
137
+    const audioMuted = roomIsValid ? getStartWithAudioMuted(state) : _AUDIO_INITIAL_MEDIA_STATE.muted;
138
+    const videoMuted = roomIsValid ? getStartWithVideoMuted(state) : _VIDEO_INITIAL_MEDIA_STATE.muted;
167 139
 
168 140
     sendAnalytics(
169 141
         createStartMutedConfigurationEvent('local', audioMuted, videoMuted));

読み込み中…
キャンセル
保存