Ver código fonte

fix(DeviceSelection): Remove video from mobile Safari

master
Mihai-Andrei Uscat 4 anos atrás
pai
commit
a564ce581d
Nenhuma conta vinculada ao e-mail do autor do commit

+ 17
- 0
css/modals/device-selection/_device-selection.scss Ver arquivo

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 Ver arquivo

64
      */
64
      */
65
     hideAudioOutputSelect: boolean,
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
      * An optional callback to invoke after the component has completed its
80
      * An optional callback to invoke after the component has completed its
69
      * mount logic.
81
      * mount logic.
201
         const {
213
         const {
202
             hideAudioInputPreview,
214
             hideAudioInputPreview,
203
             hideAudioOutputSelect,
215
             hideAudioOutputSelect,
216
+            hideVideoInputPreview,
204
             selectedAudioOutputId
217
             selectedAudioOutputId
205
         } = this.props;
218
         } = this.props;
206
 
219
 
207
         return (
220
         return (
208
-            <div className = 'device-selection'>
221
+            <div className = { `device-selection${hideVideoInputPreview ? ' video-hidden' : ''}` }>
209
                 <div className = 'device-selection-column column-video'>
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
                     { !hideAudioInputPreview
230
                     { !hideAudioInputPreview
216
                         && <AudioInputPreview
231
                         && <AudioInputPreview
217
                             track = { this.state.previewAudioTrack } /> }
232
                             track = { this.state.previewAudioTrack } /> }
264
      * @returns {void}
279
      * @returns {void}
265
      */
280
      */
266
     _createVideoInputTrack(deviceId) {
281
     _createVideoInputTrack(deviceId) {
282
+        const { hideVideoInputPreview } = this.props;
283
+
284
+        if (hideVideoInputPreview) {
285
+            return;
286
+        }
287
+
267
         return this._disposeVideoInputPreview()
288
         return this._disposeVideoInputPreview()
268
             .then(() => createLocalTrack('video', deviceId, 5000))
289
             .then(() => createLocalTrack('video', deviceId, 5000))
269
             .then(jitsiLocalTrack => {
290
             .then(jitsiLocalTrack => {
342
         const { availableDevices, hasAudioPermission, hasVideoPermission } = this.props;
363
         const { availableDevices, hasAudioPermission, hasVideoPermission } = this.props;
343
 
364
 
344
         const configurations = [
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
                 devices: availableDevices.audioInput,
367
                 devices: availableDevices.audioInput,
359
                 hasPermission: hasAudioPermission,
368
                 hasPermission: hasAudioPermission,
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
         if (!this.props.hideAudioOutputSelect) {
396
         if (!this.props.hideAudioOutputSelect) {
373
             configurations.push({
397
             configurations.push({
374
                 devices: availableDevices.audioOutput,
398
                 devices: availableDevices.audioOutput,

+ 4
- 0
react/features/device-selection/functions.js Ver arquivo

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

Carregando…
Cancelar
Salvar