ソースを参照

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 3年前
コミット
f1bf8e5f9a

+ 24
- 26
react/features/device-selection/components/DeviceSelection.js ファイルの表示

@@ -40,6 +40,11 @@ export type Props = {
40 40
      */
41 41
     disableDeviceChange: boolean,
42 42
 
43
+    /**
44
+     * Whether video input dropdown should be enabled or not.
45
+     */
46
+    disableVideoInputSelect: boolean,
47
+
43 48
     /**
44 49
      * Whether or not the audio permission was granted.
45 50
      */
@@ -57,6 +62,12 @@ export type Props = {
57 62
      */
58 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 72
      * Whether or not the audio output source selector should display. If
62 73
      * true, the audio output selector and test audio link will not be
@@ -70,12 +81,6 @@ export type Props = {
70 81
      */
71 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 85
      * An optional callback to invoke after the component has completed its
81 86
      * mount logic.
@@ -212,7 +217,7 @@ class DeviceSelection extends AbstractDialogTab<Props, State> {
212 217
     render() {
213 218
         const {
214 219
             hideAudioInputPreview,
215
-            hideAudioOutputSelect,
220
+            hideAudioOutputPreview,
216 221
             hideVideoInputPreview,
217 222
             selectedAudioOutputId
218 223
         } = this.props;
@@ -237,7 +242,7 @@ class DeviceSelection extends AbstractDialogTab<Props, State> {
237 242
                         className = 'device-selectors'>
238 243
                         { this._renderSelectors() }
239 244
                     </div>
240
-                    { !hideAudioOutputSelect
245
+                    { !hideAudioOutputPreview
241 246
                         && <AudioOutputPreview
242 247
                             deviceId = { selectedAudioOutputId } /> }
243 248
                 </div>
@@ -371,33 +376,27 @@ class DeviceSelection extends AbstractDialogTab<Props, State> {
371 376
                 devices: availableDevices.audioInput,
372 377
                 hasPermission: hasAudioPermission,
373 378
                 icon: 'icon-microphone',
374
-                isDisabled: this.props.disableAudioInputChange
375
-                    || this.props.disableDeviceChange,
379
+                isDisabled: this.props.disableAudioInputChange || this.props.disableDeviceChange,
376 380
                 key: 'audioInput',
377 381
                 id: 'audioInput',
378 382
                 label: 'settings.selectMic',
379
-                onSelect: selectedAudioInputId =>
380
-                    super._onChange({ selectedAudioInputId }),
383
+                onSelect: selectedAudioInputId => super._onChange({ selectedAudioInputId }),
381 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 388
                 devices: availableDevices.videoInput,
389 389
                 hasPermission: hasVideoPermission,
390 390
                 icon: 'icon-camera',
391
-                isDisabled: this.props.disableDeviceChange,
391
+                isDisabled: this.props.disableVideoInputSelect || this.props.disableDeviceChange,
392 392
                 key: 'videoInput',
393 393
                 id: 'videoInput',
394 394
                 label: 'settings.selectCamera',
395
-                onSelect: selectedVideoInputId =>
396
-                    super._onChange({ selectedVideoInputId }),
395
+                onSelect: selectedVideoInputId => super._onChange({ selectedVideoInputId }),
397 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 401
         if (!this.props.hideAudioOutputSelect) {
403 402
             configurations.push({
@@ -408,8 +407,7 @@ class DeviceSelection extends AbstractDialogTab<Props, State> {
408 407
                 key: 'audioOutput',
409 408
                 id: 'audioOutput',
410 409
                 label: 'settings.selectAudioOutput',
411
-                onSelect: selectedAudioOutputId =>
412
-                    super._onChange({ selectedAudioOutputId }),
410
+                onSelect: selectedAudioOutputId => super._onChange({ selectedAudioOutputId }),
413 411
                 selectedDeviceId: this.props.selectedAudioOutputId
414 412
             });
415 413
         }

+ 16
- 12
react/features/device-selection/functions.js ファイルの表示

@@ -35,10 +35,15 @@ export function getDeviceSelectionDialogProps(stateful: Object | Function) {
35 35
     const { conference } = state['features/base/conference'];
36 36
     const { permissions } = state['features/base/devices'];
37 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 42
     let disableAudioInputChange = !JitsiMeetJS.mediaDevices.isMultipleAudioInputSupported();
39
-    let selectedAudioInputId = settings.micDeviceId;
43
+    let disableVideoInputSelect = !cameraChangeSupported;
44
+    let selectedAudioInputId = isMobileSafari ? userSelectedMic : settings.micDeviceId;
40 45
     let selectedAudioOutputId = getAudioOutputDeviceId();
41
-    let selectedVideoInputId = settings.cameraDeviceId;
46
+    let selectedVideoInputId = isMobileSafari ? userSelectedCamera : settings.cameraDeviceId;
42 47
 
43 48
     // audio input change will be a problem only when we are in a
44 49
     // conference and this is not supported, when we open device selection on
@@ -46,9 +51,10 @@ export function getDeviceSelectionDialogProps(stateful: Object | Function) {
46 51
     // on welcome page we also show only what we have saved as user selected devices
47 52
     if (!conference) {
48 53
         disableAudioInputChange = false;
49
-        selectedAudioInputId = getUserSelectedMicDeviceId(state);
54
+        disableVideoInputSelect = false;
55
+        selectedAudioInputId = userSelectedMic;
50 56
         selectedAudioOutputId = getUserSelectedOutputDeviceId(state);
51
-        selectedVideoInputId = getUserSelectedCameraDeviceId(state);
57
+        selectedVideoInputId = userSelectedCamera;
52 58
     }
53 59
 
54 60
     // we fill the device selection dialog with the devices that are currently
@@ -56,16 +62,14 @@ export function getDeviceSelectionDialogProps(stateful: Object | Function) {
56 62
     return {
57 63
         availableDevices: state['features/base/devices'].availableDevices,
58 64
         disableAudioInputChange,
59
-        disableDeviceChange:
60
-            !JitsiMeetJS.mediaDevices.isDeviceChangeAvailable(),
65
+        disableDeviceChange: !JitsiMeetJS.mediaDevices.isDeviceChangeAvailable(),
66
+        disableVideoInputSelect,
61 67
         hasAudioPermission: permissions.audio,
62 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 73
         selectedAudioInputId,
70 74
         selectedAudioOutputId,
71 75
         selectedVideoInputId

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