Browse Source

fix(settings) Disable mic/camera selection on mobile safari.

Creating a preview of the same audio/video track kills the tracks that is already being shared in the conference. Therefore, disable camera/mic selection in the settings dialog while the user is in the call. The devices are selectable from the prejoin screen settings dialog.
master
Jaya Allamsetty 4 years ago
parent
commit
f1bf8e5f9a

+ 24
- 26
react/features/device-selection/components/DeviceSelection.js View File

40
      */
40
      */
41
     disableDeviceChange: boolean,
41
     disableDeviceChange: boolean,
42
 
42
 
43
+    /**
44
+     * Whether video input dropdown should be enabled or not.
45
+     */
46
+    disableVideoInputSelect: boolean,
47
+
43
     /**
48
     /**
44
      * Whether or not the audio permission was granted.
49
      * Whether or not the audio permission was granted.
45
      */
50
      */
57
      */
62
      */
58
     hideAudioInputPreview: boolean,
63
     hideAudioInputPreview: boolean,
59
 
64
 
65
+    /**
66
+     * If true, the button to play a test sound on the selected speaker will not be displayed.
67
+     * This needs to be hidden on browsers that do not support selecting an audio output device.
68
+     */
69
+    hideAudioOutputPreview: boolean,
70
+
60
     /**
71
     /**
61
      * Whether or not the audio output source selector should display. If
72
      * Whether or not the audio output source selector should display. If
62
      * true, the audio output selector and test audio link will not be
73
      * true, the audio output selector and test audio link will not be
70
      */
81
      */
71
     hideVideoInputPreview: boolean,
82
     hideVideoInputPreview: boolean,
72
 
83
 
73
-    /**
74
-     * Whether video output dropdown should be displayed or not.
75
-     * (In the case of iOS Safari)
76
-     */
77
-    hideVideoOutputSelect: boolean,
78
-
79
     /**
84
     /**
80
      * An optional callback to invoke after the component has completed its
85
      * An optional callback to invoke after the component has completed its
81
      * mount logic.
86
      * mount logic.
212
     render() {
217
     render() {
213
         const {
218
         const {
214
             hideAudioInputPreview,
219
             hideAudioInputPreview,
215
-            hideAudioOutputSelect,
220
+            hideAudioOutputPreview,
216
             hideVideoInputPreview,
221
             hideVideoInputPreview,
217
             selectedAudioOutputId
222
             selectedAudioOutputId
218
         } = this.props;
223
         } = this.props;
237
                         className = 'device-selectors'>
242
                         className = 'device-selectors'>
238
                         { this._renderSelectors() }
243
                         { this._renderSelectors() }
239
                     </div>
244
                     </div>
240
-                    { !hideAudioOutputSelect
245
+                    { !hideAudioOutputPreview
241
                         && <AudioOutputPreview
246
                         && <AudioOutputPreview
242
                             deviceId = { selectedAudioOutputId } /> }
247
                             deviceId = { selectedAudioOutputId } /> }
243
                 </div>
248
                 </div>
371
                 devices: availableDevices.audioInput,
376
                 devices: availableDevices.audioInput,
372
                 hasPermission: hasAudioPermission,
377
                 hasPermission: hasAudioPermission,
373
                 icon: 'icon-microphone',
378
                 icon: 'icon-microphone',
374
-                isDisabled: this.props.disableAudioInputChange
375
-                    || this.props.disableDeviceChange,
379
+                isDisabled: this.props.disableAudioInputChange || this.props.disableDeviceChange,
376
                 key: 'audioInput',
380
                 key: 'audioInput',
377
                 id: 'audioInput',
381
                 id: 'audioInput',
378
                 label: 'settings.selectMic',
382
                 label: 'settings.selectMic',
379
-                onSelect: selectedAudioInputId =>
380
-                    super._onChange({ selectedAudioInputId }),
383
+                onSelect: selectedAudioInputId => super._onChange({ selectedAudioInputId }),
381
                 selectedDeviceId: this.state.previewAudioTrack
384
                 selectedDeviceId: this.state.previewAudioTrack
382
-                    ? this.state.previewAudioTrack.getDeviceId() : null
383
-            }
384
-        ];
385
-
386
-        if (!this.props.hideVideoOutputSelect) {
387
-            configurations.unshift({
385
+                    ? this.state.previewAudioTrack.getDeviceId() : this.props.selectedAudioInputId
386
+            },
387
+            {
388
                 devices: availableDevices.videoInput,
388
                 devices: availableDevices.videoInput,
389
                 hasPermission: hasVideoPermission,
389
                 hasPermission: hasVideoPermission,
390
                 icon: 'icon-camera',
390
                 icon: 'icon-camera',
391
-                isDisabled: this.props.disableDeviceChange,
391
+                isDisabled: this.props.disableVideoInputSelect || this.props.disableDeviceChange,
392
                 key: 'videoInput',
392
                 key: 'videoInput',
393
                 id: 'videoInput',
393
                 id: 'videoInput',
394
                 label: 'settings.selectCamera',
394
                 label: 'settings.selectCamera',
395
-                onSelect: selectedVideoInputId =>
396
-                    super._onChange({ selectedVideoInputId }),
395
+                onSelect: selectedVideoInputId => super._onChange({ selectedVideoInputId }),
397
                 selectedDeviceId: this.state.previewVideoTrack
396
                 selectedDeviceId: this.state.previewVideoTrack
398
-                    ? this.state.previewVideoTrack.getDeviceId() : null
399
-            });
400
-        }
397
+                    ? this.state.previewVideoTrack.getDeviceId() : this.props.selectedVideoInputId
398
+            }
399
+        ];
401
 
400
 
402
         if (!this.props.hideAudioOutputSelect) {
401
         if (!this.props.hideAudioOutputSelect) {
403
             configurations.push({
402
             configurations.push({
408
                 key: 'audioOutput',
407
                 key: 'audioOutput',
409
                 id: 'audioOutput',
408
                 id: 'audioOutput',
410
                 label: 'settings.selectAudioOutput',
409
                 label: 'settings.selectAudioOutput',
411
-                onSelect: selectedAudioOutputId =>
412
-                    super._onChange({ selectedAudioOutputId }),
410
+                onSelect: selectedAudioOutputId => super._onChange({ selectedAudioOutputId }),
413
                 selectedDeviceId: this.props.selectedAudioOutputId
411
                 selectedDeviceId: this.props.selectedAudioOutputId
414
             });
412
             });
415
         }
413
         }

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

35
     const { conference } = state['features/base/conference'];
35
     const { conference } = state['features/base/conference'];
36
     const { permissions } = state['features/base/devices'];
36
     const { permissions } = state['features/base/devices'];
37
     const isMobileSafari = isIosMobileBrowser();
37
     const isMobileSafari = isIosMobileBrowser();
38
+    const cameraChangeSupported = JitsiMeetJS.mediaDevices.isDeviceChangeAvailable('input');
39
+    const speakerChangeSupported = JitsiMeetJS.mediaDevices.isDeviceChangeAvailable('output');
40
+    const userSelectedCamera = getUserSelectedCameraDeviceId(state);
41
+    const userSelectedMic = getUserSelectedMicDeviceId(state);
38
     let disableAudioInputChange = !JitsiMeetJS.mediaDevices.isMultipleAudioInputSupported();
42
     let disableAudioInputChange = !JitsiMeetJS.mediaDevices.isMultipleAudioInputSupported();
39
-    let selectedAudioInputId = settings.micDeviceId;
43
+    let disableVideoInputSelect = !cameraChangeSupported;
44
+    let selectedAudioInputId = isMobileSafari ? userSelectedMic : settings.micDeviceId;
40
     let selectedAudioOutputId = getAudioOutputDeviceId();
45
     let selectedAudioOutputId = getAudioOutputDeviceId();
41
-    let selectedVideoInputId = settings.cameraDeviceId;
46
+    let selectedVideoInputId = isMobileSafari ? userSelectedCamera : settings.cameraDeviceId;
42
 
47
 
43
     // audio input change will be a problem only when we are in a
48
     // audio input change will be a problem only when we are in a
44
     // conference and this is not supported, when we open device selection on
49
     // conference and this is not supported, when we open device selection on
46
     // on welcome page we also show only what we have saved as user selected devices
51
     // on welcome page we also show only what we have saved as user selected devices
47
     if (!conference) {
52
     if (!conference) {
48
         disableAudioInputChange = false;
53
         disableAudioInputChange = false;
49
-        selectedAudioInputId = getUserSelectedMicDeviceId(state);
54
+        disableVideoInputSelect = false;
55
+        selectedAudioInputId = userSelectedMic;
50
         selectedAudioOutputId = getUserSelectedOutputDeviceId(state);
56
         selectedAudioOutputId = getUserSelectedOutputDeviceId(state);
51
-        selectedVideoInputId = getUserSelectedCameraDeviceId(state);
57
+        selectedVideoInputId = userSelectedCamera;
52
     }
58
     }
53
 
59
 
54
     // we fill the device selection dialog with the devices that are currently
60
     // we fill the device selection dialog with the devices that are currently
56
     return {
62
     return {
57
         availableDevices: state['features/base/devices'].availableDevices,
63
         availableDevices: state['features/base/devices'].availableDevices,
58
         disableAudioInputChange,
64
         disableAudioInputChange,
59
-        disableDeviceChange:
60
-            !JitsiMeetJS.mediaDevices.isDeviceChangeAvailable(),
65
+        disableDeviceChange: !JitsiMeetJS.mediaDevices.isDeviceChangeAvailable(),
66
+        disableVideoInputSelect,
61
         hasAudioPermission: permissions.audio,
67
         hasAudioPermission: permissions.audio,
62
         hasVideoPermission: permissions.video,
68
         hasVideoPermission: permissions.video,
63
-        hideAudioInputPreview:
64
-            !JitsiMeetJS.isCollectingLocalStats(),
65
-        hideAudioOutputSelect: !JitsiMeetJS.mediaDevices
66
-                            .isDeviceChangeAvailable('output'),
67
-        hideVideoInputPreview: isMobileSafari,
68
-        hideVideoOutputSelect: isMobileSafari,
69
+        hideAudioInputPreview: disableAudioInputChange || !JitsiMeetJS.isCollectingLocalStats(),
70
+        hideAudioOutputPreview: !speakerChangeSupported,
71
+        hideAudioOutputSelect: !speakerChangeSupported,
72
+        hideVideoInputPreview: !cameraChangeSupported,
69
         selectedAudioInputId,
73
         selectedAudioInputId,
70
         selectedAudioOutputId,
74
         selectedAudioOutputId,
71
         selectedVideoInputId
75
         selectedVideoInputId

Loading…
Cancel
Save