Browse Source

fix(device-selection): Handle properly on prejoin

The device selection initialization on the prejoin use case was handled
like the welcome page. This was introducing issues with selecting the
stored devices and not the ones used, enabling the device selection when
it will fail and others.
master
Hristo Terezov 3 years ago
parent
commit
ae565aaac6

+ 4
- 2
react/features/device-selection/actions.js View File

14
  * Submits the settings related to device selection.
14
  * Submits the settings related to device selection.
15
  *
15
  *
16
  * @param {Object} newState - The new settings.
16
  * @param {Object} newState - The new settings.
17
+ * @param {boolean} isDisplayedOnWelcomePage - Indicates whether the device selection dialog is displayed on the
18
+ * welcome page or not.
17
  * @returns {Function}
19
  * @returns {Function}
18
  */
20
  */
19
-export function submitDeviceSelectionTab(newState) {
21
+export function submitDeviceSelectionTab(newState, isDisplayedOnWelcomePage) {
20
     return (dispatch, getState) => {
22
     return (dispatch, getState) => {
21
-        const currentState = getDeviceSelectionDialogProps(getState());
23
+        const currentState = getDeviceSelectionDialogProps(getState(), isDisplayedOnWelcomePage);
22
 
24
 
23
         if (newState.selectedVideoInputId && (newState.selectedVideoInputId !== currentState.selectedVideoInputId)) {
25
         if (newState.selectedVideoInputId && (newState.selectedVideoInputId !== currentState.selectedVideoInputId)) {
24
             dispatch(updateSettings({
26
             dispatch(updateSettings({

+ 12
- 7
react/features/device-selection/functions.js View File

27
  *
27
  *
28
  * @param {(Function|Object)} stateful -The (whole) redux state, or redux's
28
  * @param {(Function|Object)} stateful -The (whole) redux state, or redux's
29
  * {@code getState} function to be used to retrieve the state.
29
  * {@code getState} function to be used to retrieve the state.
30
+ * @param {boolean} isDisplayedOnWelcomePage - Indicates whether the device selection dialog is displayed on the
31
+ * welcome page or not.
30
  * @returns {Object} - The properties for the device selection dialog.
32
  * @returns {Object} - The properties for the device selection dialog.
31
  */
33
  */
32
-export function getDeviceSelectionDialogProps(stateful: Object | Function) {
34
+export function getDeviceSelectionDialogProps(stateful: Object | Function, isDisplayedOnWelcomePage) {
33
     // On mobile Safari because of https://bugs.webkit.org/show_bug.cgi?id=179363#c30, the old track is stopped
35
     // On mobile Safari because of https://bugs.webkit.org/show_bug.cgi?id=179363#c30, the old track is stopped
34
     // by the browser when a new track is created for preview. That's why we are disabling all previews.
36
     // by the browser when a new track is created for preview. That's why we are disabling all previews.
35
     const disablePreviews = isIosMobileBrowser();
37
     const disablePreviews = isIosMobileBrowser();
36
 
38
 
37
     const state = toState(stateful);
39
     const state = toState(stateful);
38
     const settings = state['features/base/settings'];
40
     const settings = state['features/base/settings'];
39
-    const { conference } = state['features/base/conference'];
40
     const { permissions } = state['features/base/devices'];
41
     const { permissions } = state['features/base/devices'];
41
-    const cameraChangeSupported = JitsiMeetJS.mediaDevices.isDeviceChangeAvailable('input');
42
+    const inputDeviceChangeSupported = JitsiMeetJS.mediaDevices.isDeviceChangeAvailable('input');
42
     const speakerChangeSupported = JitsiMeetJS.mediaDevices.isDeviceChangeAvailable('output');
43
     const speakerChangeSupported = JitsiMeetJS.mediaDevices.isDeviceChangeAvailable('output');
43
     const userSelectedCamera = getUserSelectedCameraDeviceId(state);
44
     const userSelectedCamera = getUserSelectedCameraDeviceId(state);
44
     const userSelectedMic = getUserSelectedMicDeviceId(state);
45
     const userSelectedMic = getUserSelectedMicDeviceId(state);
45
-    let disableAudioInputChange = !JitsiMeetJS.mediaDevices.isMultipleAudioInputSupported();
46
-    let disableVideoInputSelect = !cameraChangeSupported;
46
+
47
+    // When the previews are disabled we don't need multiple audio input support in order to chage the mic. This is the
48
+    // case for Safari on iOS.
49
+    let disableAudioInputChange
50
+        = !JitsiMeetJS.mediaDevices.isMultipleAudioInputSupported() && !(disablePreviews && inputDeviceChangeSupported);
51
+    let disableVideoInputSelect = !inputDeviceChangeSupported;
47
     let selectedAudioInputId = settings.micDeviceId;
52
     let selectedAudioInputId = settings.micDeviceId;
48
     let selectedAudioOutputId = getAudioOutputDeviceId();
53
     let selectedAudioOutputId = getAudioOutputDeviceId();
49
     let selectedVideoInputId = settings.cameraDeviceId;
54
     let selectedVideoInputId = settings.cameraDeviceId;
52
     // conference and this is not supported, when we open device selection on
57
     // conference and this is not supported, when we open device selection on
53
     // welcome page changing input devices will not be a problem
58
     // welcome page changing input devices will not be a problem
54
     // on welcome page we also show only what we have saved as user selected devices
59
     // on welcome page we also show only what we have saved as user selected devices
55
-    if (!conference) {
60
+    if (isDisplayedOnWelcomePage) {
56
         disableAudioInputChange = false;
61
         disableAudioInputChange = false;
57
         disableVideoInputSelect = false;
62
         disableVideoInputSelect = false;
58
         selectedAudioInputId = userSelectedMic;
63
         selectedAudioInputId = userSelectedMic;
72
         hideAudioInputPreview: disableAudioInputChange || !JitsiMeetJS.isCollectingLocalStats() || disablePreviews,
77
         hideAudioInputPreview: disableAudioInputChange || !JitsiMeetJS.isCollectingLocalStats() || disablePreviews,
73
         hideAudioOutputPreview: !speakerChangeSupported || disablePreviews,
78
         hideAudioOutputPreview: !speakerChangeSupported || disablePreviews,
74
         hideAudioOutputSelect: !speakerChangeSupported,
79
         hideAudioOutputSelect: !speakerChangeSupported,
75
-        hideVideoInputPreview: !cameraChangeSupported || disablePreviews,
80
+        hideVideoInputPreview: !inputDeviceChangeSupported || disablePreviews,
76
         selectedAudioInputId,
81
         selectedAudioInputId,
77
         selectedAudioOutputId,
82
         selectedAudioOutputId,
78
         selectedVideoInputId
83
         selectedVideoInputId

+ 7
- 2
react/features/settings/actions.js View File

43
  *
43
  *
44
  * @param {string} defaultTab - The tab in {@code SettingsDialog} that should be
44
  * @param {string} defaultTab - The tab in {@code SettingsDialog} that should be
45
  * displayed initially.
45
  * displayed initially.
46
+ * @param {boolean} isDisplayedOnWelcomePage - Indicates whether the device selection dialog is displayed on the
47
+ * welcome page or not.
46
  * @returns {Function}
48
  * @returns {Function}
47
  */
49
  */
48
-export function openSettingsDialog(defaultTab: string) {
49
-    return openDialog(SettingsDialog, { defaultTab });
50
+export function openSettingsDialog(defaultTab: string, isDisplayedOnWelcomePage: boolean) {
51
+    return openDialog(SettingsDialog, {
52
+        defaultTab,
53
+        isDisplayedOnWelcomePage
54
+    });
50
 }
55
 }
51
 
56
 
52
 /**
57
 /**

+ 9
- 3
react/features/settings/components/web/SettingsButton.js View File

21
     /**
21
     /**
22
      * The redux {@code dispatch} function.
22
      * The redux {@code dispatch} function.
23
      */
23
      */
24
-    dispatch: Function
24
+    dispatch: Function,
25
+
26
+    /**
27
+     * Indicates whether the device selection dialog is displayed on the
28
+     * welcome page or not.
29
+     */
30
+    isDisplayedOnWelcomePage: boolean
25
 };
31
 };
26
 
32
 
27
 /**
33
 /**
40
      * @returns {void}
46
      * @returns {void}
41
      */
47
      */
42
     _handleClick() {
48
     _handleClick() {
43
-        const { defaultTab = SETTINGS_TABS.DEVICES, dispatch } = this.props;
49
+        const { defaultTab = SETTINGS_TABS.DEVICES, dispatch, isDisplayedOnWelcomePage = false } = this.props;
44
 
50
 
45
         sendAnalytics(createToolbarEvent('settings'));
51
         sendAnalytics(createToolbarEvent('settings'));
46
-        dispatch(openSettingsDialog(defaultTab));
52
+        dispatch(openSettingsDialog(defaultTab, isDisplayedOnWelcomePage));
47
     }
53
     }
48
 }
54
 }
49
 
55
 

+ 10
- 4
react/features/settings/components/web/SettingsDialog.js View File

59
     /**
59
     /**
60
      * Invoked to save changed settings.
60
      * Invoked to save changed settings.
61
      */
61
      */
62
-    dispatch: Function
62
+    dispatch: Function,
63
+
64
+    /**
65
+     * Indicates whether the device selection dialog is displayed on the
66
+     * welcome page or not.
67
+     */
68
+    isDisplayedOnWelcomePage: boolean
63
 };
69
 };
64
 
70
 
65
 /**
71
 /**
253
  * }}
259
  * }}
254
  */
260
  */
255
 function _mapStateToProps(state, ownProps) {
261
 function _mapStateToProps(state, ownProps) {
256
-    const { classes } = ownProps;
262
+    const { classes, isDisplayedOnWelcomePage } = ownProps;
257
     const configuredTabs = interfaceConfig.SETTINGS_SECTIONS || [];
263
     const configuredTabs = interfaceConfig.SETTINGS_SECTIONS || [];
258
 
264
 
259
     // The settings sections to display.
265
     // The settings sections to display.
276
             component: DeviceSelection,
282
             component: DeviceSelection,
277
             label: 'settings.devices',
283
             label: 'settings.devices',
278
             onMount: getAvailableDevices,
284
             onMount: getAvailableDevices,
279
-            props: getDeviceSelectionDialogProps(state),
285
+            props: getDeviceSelectionDialogProps(state, isDisplayedOnWelcomePage),
280
             propsUpdateFunction: (tabState, newProps) => {
286
             propsUpdateFunction: (tabState, newProps) => {
281
                 // Ensure the device selection tab gets updated when new devices
287
                 // Ensure the device selection tab gets updated when new devices
282
                 // are found by taking the new props and only preserving the
288
                 // are found by taking the new props and only preserving the
292
                 };
298
                 };
293
             },
299
             },
294
             styles: `settings-pane ${classes.settingsDialog} devices-pane`,
300
             styles: `settings-pane ${classes.settingsDialog} devices-pane`,
295
-            submit: submitDeviceSelectionTab
301
+            submit: newState => submitDeviceSelectionTab(newState, isDisplayedOnWelcomePage)
296
         });
302
         });
297
     }
303
     }
298
 
304
 

+ 2
- 1
react/features/welcome/components/WelcomePage.web.js View File

191
                 <div className = 'header'>
191
                 <div className = 'header'>
192
                     <div className = 'welcome-page-settings'>
192
                     <div className = 'welcome-page-settings'>
193
                         <SettingsButton
193
                         <SettingsButton
194
-                            defaultTab = { SETTINGS_TABS.CALENDAR } />
194
+                            defaultTab = { SETTINGS_TABS.CALENDAR }
195
+                            isDisplayedOnWelcomePage = { true } />
195
                         { showAdditionalToolbarContent
196
                         { showAdditionalToolbarContent
196
                             ? <div
197
                             ? <div
197
                                 className = 'settings-toolbar-content'
198
                                 className = 'settings-toolbar-content'

Loading…
Cancel
Save