Преглед изворни кода

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 година
родитељ
комит
ae565aaac6

+ 4
- 2
react/features/device-selection/actions.js Прегледај датотеку

@@ -14,11 +14,13 @@ import logger from './logger';
14 14
  * Submits the settings related to device selection.
15 15
  *
16 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 19
  * @returns {Function}
18 20
  */
19
-export function submitDeviceSelectionTab(newState) {
21
+export function submitDeviceSelectionTab(newState, isDisplayedOnWelcomePage) {
20 22
     return (dispatch, getState) => {
21
-        const currentState = getDeviceSelectionDialogProps(getState());
23
+        const currentState = getDeviceSelectionDialogProps(getState(), isDisplayedOnWelcomePage);
22 24
 
23 25
         if (newState.selectedVideoInputId && (newState.selectedVideoInputId !== currentState.selectedVideoInputId)) {
24 26
             dispatch(updateSettings({

+ 12
- 7
react/features/device-selection/functions.js Прегледај датотеку

@@ -27,23 +27,28 @@ import {
27 27
  *
28 28
  * @param {(Function|Object)} stateful -The (whole) redux state, or redux's
29 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 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 35
     // On mobile Safari because of https://bugs.webkit.org/show_bug.cgi?id=179363#c30, the old track is stopped
34 36
     // by the browser when a new track is created for preview. That's why we are disabling all previews.
35 37
     const disablePreviews = isIosMobileBrowser();
36 38
 
37 39
     const state = toState(stateful);
38 40
     const settings = state['features/base/settings'];
39
-    const { conference } = state['features/base/conference'];
40 41
     const { permissions } = state['features/base/devices'];
41
-    const cameraChangeSupported = JitsiMeetJS.mediaDevices.isDeviceChangeAvailable('input');
42
+    const inputDeviceChangeSupported = JitsiMeetJS.mediaDevices.isDeviceChangeAvailable('input');
42 43
     const speakerChangeSupported = JitsiMeetJS.mediaDevices.isDeviceChangeAvailable('output');
43 44
     const userSelectedCamera = getUserSelectedCameraDeviceId(state);
44 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 52
     let selectedAudioInputId = settings.micDeviceId;
48 53
     let selectedAudioOutputId = getAudioOutputDeviceId();
49 54
     let selectedVideoInputId = settings.cameraDeviceId;
@@ -52,7 +57,7 @@ export function getDeviceSelectionDialogProps(stateful: Object | Function) {
52 57
     // conference and this is not supported, when we open device selection on
53 58
     // welcome page changing input devices will not be a problem
54 59
     // on welcome page we also show only what we have saved as user selected devices
55
-    if (!conference) {
60
+    if (isDisplayedOnWelcomePage) {
56 61
         disableAudioInputChange = false;
57 62
         disableVideoInputSelect = false;
58 63
         selectedAudioInputId = userSelectedMic;
@@ -72,7 +77,7 @@ export function getDeviceSelectionDialogProps(stateful: Object | Function) {
72 77
         hideAudioInputPreview: disableAudioInputChange || !JitsiMeetJS.isCollectingLocalStats() || disablePreviews,
73 78
         hideAudioOutputPreview: !speakerChangeSupported || disablePreviews,
74 79
         hideAudioOutputSelect: !speakerChangeSupported,
75
-        hideVideoInputPreview: !cameraChangeSupported || disablePreviews,
80
+        hideVideoInputPreview: !inputDeviceChangeSupported || disablePreviews,
76 81
         selectedAudioInputId,
77 82
         selectedAudioOutputId,
78 83
         selectedVideoInputId

+ 7
- 2
react/features/settings/actions.js Прегледај датотеку

@@ -43,10 +43,15 @@ export function openLogoutDialog(onLogout: Function) {
43 43
  *
44 44
  * @param {string} defaultTab - The tab in {@code SettingsDialog} that should be
45 45
  * displayed initially.
46
+ * @param {boolean} isDisplayedOnWelcomePage - Indicates whether the device selection dialog is displayed on the
47
+ * welcome page or not.
46 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 Прегледај датотеку

@@ -21,7 +21,13 @@ type Props = AbstractButtonProps & {
21 21
     /**
22 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,10 +46,10 @@ class SettingsButton extends AbstractButton<Props, *> {
40 46
      * @returns {void}
41 47
      */
42 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 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 Прегледај датотеку

@@ -59,7 +59,13 @@ type Props = {
59 59
     /**
60 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,7 +259,7 @@ class SettingsDialog extends Component<Props> {
253 259
  * }}
254 260
  */
255 261
 function _mapStateToProps(state, ownProps) {
256
-    const { classes } = ownProps;
262
+    const { classes, isDisplayedOnWelcomePage } = ownProps;
257 263
     const configuredTabs = interfaceConfig.SETTINGS_SECTIONS || [];
258 264
 
259 265
     // The settings sections to display.
@@ -276,7 +282,7 @@ function _mapStateToProps(state, ownProps) {
276 282
             component: DeviceSelection,
277 283
             label: 'settings.devices',
278 284
             onMount: getAvailableDevices,
279
-            props: getDeviceSelectionDialogProps(state),
285
+            props: getDeviceSelectionDialogProps(state, isDisplayedOnWelcomePage),
280 286
             propsUpdateFunction: (tabState, newProps) => {
281 287
                 // Ensure the device selection tab gets updated when new devices
282 288
                 // are found by taking the new props and only preserving the
@@ -292,7 +298,7 @@ function _mapStateToProps(state, ownProps) {
292 298
                 };
293 299
             },
294 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 Прегледај датотеку

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

Loading…
Откажи
Сачувај