Przeglądaj źródła

fix(DeviceSelection): Remove video from mobile Safari

master
Mihai-Andrei Uscat 4 lat temu
rodzic
commit
a564ce581d
No account linked to committer's email address

+ 17
- 0
css/modals/device-selection/_device-selection.scss Wyświetl plik

@@ -129,3 +129,20 @@
129 129
         }
130 130
     }
131 131
 }
132
+
133
+.device-selection.video-hidden {
134
+    display: flex;
135
+    flex-direction: column;
136
+    width: 100%;
137
+
138
+    .column-selectors {
139
+        width: 100%;
140
+        margin-left: 0;
141
+    }
142
+
143
+    .column-video {
144
+        order: 1;
145
+        width: 100%;
146
+        margin-top: 8px;
147
+    }
148
+}

+ 42
- 18
react/features/device-selection/components/DeviceSelection.js Wyświetl plik

@@ -64,6 +64,18 @@ export type Props = {
64 64
      */
65 65
     hideAudioOutputSelect: boolean,
66 66
 
67
+    /**
68
+     * Whether video input preview should be displayed or not.
69
+     * (In the case of iOS Safari)
70
+     */
71
+    hideVideoInputPreview: boolean,
72
+
73
+    /**
74
+     * Whether video output dropdown should be displayed or not.
75
+     * (In the case of iOS Safari)
76
+     */
77
+    hideVideoOutputSelect: boolean,
78
+
67 79
     /**
68 80
      * An optional callback to invoke after the component has completed its
69 81
      * mount logic.
@@ -201,17 +213,20 @@ class DeviceSelection extends AbstractDialogTab<Props, State> {
201 213
         const {
202 214
             hideAudioInputPreview,
203 215
             hideAudioOutputSelect,
216
+            hideVideoInputPreview,
204 217
             selectedAudioOutputId
205 218
         } = this.props;
206 219
 
207 220
         return (
208
-            <div className = 'device-selection'>
221
+            <div className = { `device-selection${hideVideoInputPreview ? ' video-hidden' : ''}` }>
209 222
                 <div className = 'device-selection-column column-video'>
210
-                    <div className = 'device-selection-video-container'>
211
-                        <VideoInputPreview
212
-                            error = { this.state.previewVideoTrackError }
213
-                            track = { this.state.previewVideoTrack } />
214
-                    </div>
223
+                    { !hideVideoInputPreview
224
+                        && <div className = 'device-selection-video-container'>
225
+                            <VideoInputPreview
226
+                                error = { this.state.previewVideoTrackError }
227
+                                track = { this.state.previewVideoTrack } />
228
+                        </div>
229
+                    }
215 230
                     { !hideAudioInputPreview
216 231
                         && <AudioInputPreview
217 232
                             track = { this.state.previewAudioTrack } /> }
@@ -264,6 +279,12 @@ class DeviceSelection extends AbstractDialogTab<Props, State> {
264 279
      * @returns {void}
265 280
      */
266 281
     _createVideoInputTrack(deviceId) {
282
+        const { hideVideoInputPreview } = this.props;
283
+
284
+        if (hideVideoInputPreview) {
285
+            return;
286
+        }
287
+
267 288
         return this._disposeVideoInputPreview()
268 289
             .then(() => createLocalTrack('video', deviceId, 5000))
269 290
             .then(jitsiLocalTrack => {
@@ -342,18 +363,6 @@ class DeviceSelection extends AbstractDialogTab<Props, State> {
342 363
         const { availableDevices, hasAudioPermission, hasVideoPermission } = this.props;
343 364
 
344 365
         const configurations = [
345
-            {
346
-                devices: availableDevices.videoInput,
347
-                hasPermission: hasVideoPermission,
348
-                icon: 'icon-camera',
349
-                isDisabled: this.props.disableDeviceChange,
350
-                key: 'videoInput',
351
-                label: 'settings.selectCamera',
352
-                onSelect: selectedVideoInputId =>
353
-                    super._onChange({ selectedVideoInputId }),
354
-                selectedDeviceId: this.state.previewVideoTrack
355
-                    ? this.state.previewVideoTrack.getDeviceId() : null
356
-            },
357 366
             {
358 367
                 devices: availableDevices.audioInput,
359 368
                 hasPermission: hasAudioPermission,
@@ -369,6 +378,21 @@ class DeviceSelection extends AbstractDialogTab<Props, State> {
369 378
             }
370 379
         ];
371 380
 
381
+        if (!this.props.hideVideoOutputSelect) {
382
+            configurations.unshift({
383
+                devices: availableDevices.videoInput,
384
+                hasPermission: hasVideoPermission,
385
+                icon: 'icon-camera',
386
+                isDisabled: this.props.disableDeviceChange,
387
+                key: 'videoInput',
388
+                label: 'settings.selectCamera',
389
+                onSelect: selectedVideoInputId =>
390
+                    super._onChange({ selectedVideoInputId }),
391
+                selectedDeviceId: this.state.previewVideoTrack
392
+                    ? this.state.previewVideoTrack.getDeviceId() : null
393
+            });
394
+        }
395
+
372 396
         if (!this.props.hideAudioOutputSelect) {
373 397
             configurations.push({
374 398
                 devices: availableDevices.audioOutput,

+ 4
- 0
react/features/device-selection/functions.js Wyświetl plik

@@ -13,6 +13,7 @@ import {
13 13
     setAudioOutputDeviceId,
14 14
     setVideoInputDevice
15 15
 } from '../base/devices';
16
+import { isIosMobileBrowser } from '../base/environment/utils';
16 17
 import JitsiMeetJS from '../base/lib-jitsi-meet';
17 18
 import { toState } from '../base/redux';
18 19
 import {
@@ -33,6 +34,7 @@ export function getDeviceSelectionDialogProps(stateful: Object | Function) {
33 34
     const settings = state['features/base/settings'];
34 35
     const { conference } = state['features/base/conference'];
35 36
     const { permissions } = state['features/base/devices'];
37
+    const isMobileSafari = isIosMobileBrowser();
36 38
     let disableAudioInputChange = !JitsiMeetJS.mediaDevices.isMultipleAudioInputSupported();
37 39
     let selectedAudioInputId = settings.micDeviceId;
38 40
     let selectedAudioOutputId = getAudioOutputDeviceId();
@@ -62,6 +64,8 @@ export function getDeviceSelectionDialogProps(stateful: Object | Function) {
62 64
             !JitsiMeetJS.isCollectingLocalStats(),
63 65
         hideAudioOutputSelect: !JitsiMeetJS.mediaDevices
64 66
                             .isDeviceChangeAvailable('output'),
67
+        hideVideoInputPreview: isMobileSafari,
68
+        hideVideoOutputSelect: isMobileSafari,
65 69
         selectedAudioInputId,
66 70
         selectedAudioOutputId,
67 71
         selectedVideoInputId

Ładowanie…
Anuluj
Zapisz