Bläddra i källkod

fix(device-selection):iOS Safari disable previews

On iOS Safari when the tracks for the previews are created the old ones
are auto destroyed which leads many issues like stop sending media while
the devie selectioin is displayed, error messages, etc.
master
Hristo Terezov 3 år sedan
förälder
incheckning
8cd259c43f

+ 2
- 11
react/features/device-selection/actions.js Visa fil

@@ -5,8 +5,6 @@ import {
5 5
     setAudioOutputDeviceId,
6 6
     setVideoInputDevice
7 7
 } from '../base/devices';
8
-import { isIosMobileBrowser } from '../base/environment/utils';
9
-import { browser } from '../base/lib-jitsi-meet';
10 8
 import { updateSettings } from '../base/settings';
11 9
 
12 10
 import { getDeviceSelectionDialogProps } from './functions';
@@ -19,16 +17,10 @@ import logger from './logger';
19 17
  * @returns {Function}
20 18
  */
21 19
 export function submitDeviceSelectionTab(newState) {
22
-    // Always use the new track for mobile Safari because of https://bugs.webkit.org/show_bug.cgi?id=179363#c30. The
23
-    // old track is stopped by the browser when a new track is created for preview so it needs to be replaced even if
24
-    // the device selection doesn't change.
25
-    const replaceTrackAlways = isIosMobileBrowser() && browser.isVersionGreaterThan('15.3');
26
-
27 20
     return (dispatch, getState) => {
28 21
         const currentState = getDeviceSelectionDialogProps(getState());
29 22
 
30
-        if ((newState.selectedVideoInputId && (newState.selectedVideoInputId !== currentState.selectedVideoInputId))
31
-            || replaceTrackAlways) {
23
+        if (newState.selectedVideoInputId && (newState.selectedVideoInputId !== currentState.selectedVideoInputId)) {
32 24
             dispatch(updateSettings({
33 25
                 userSelectedCameraDeviceId: newState.selectedVideoInputId,
34 26
                 userSelectedCameraDeviceLabel:
@@ -38,8 +30,7 @@ export function submitDeviceSelectionTab(newState) {
38 30
             dispatch(setVideoInputDevice(newState.selectedVideoInputId));
39 31
         }
40 32
 
41
-        if ((newState.selectedAudioInputId && newState.selectedAudioInputId !== currentState.selectedAudioInputId)
42
-            || replaceTrackAlways) {
33
+        if (newState.selectedAudioInputId && newState.selectedAudioInputId !== currentState.selectedAudioInputId) {
43 34
             dispatch(updateSettings({
44 35
                 userSelectedMicDeviceId: newState.selectedAudioInputId,
45 36
                 userSelectedMicDeviceLabel:

+ 9
- 4
react/features/device-selection/functions.js Visa fil

@@ -13,7 +13,8 @@ import {
13 13
     setAudioOutputDevice,
14 14
     setVideoInputDeviceAndUpdateSettings
15 15
 } from '../base/devices';
16
-import JitsiMeetJS from '../base/lib-jitsi-meet';
16
+import { isIosMobileBrowser } from '../base/environment/utils';
17
+import JitsiMeetJS, { browser } from '../base/lib-jitsi-meet';
17 18
 import { toState } from '../base/redux';
18 19
 import {
19 20
     getUserSelectedCameraDeviceId,
@@ -29,6 +30,10 @@ import {
29 30
  * @returns {Object} - The properties for the device selection dialog.
30 31
  */
31 32
 export function getDeviceSelectionDialogProps(stateful: Object | Function) {
33
+    // On mobile Safari because of https://bugs.webkit.org/show_bug.cgi?id=179363#c30, the old track is stopped
34
+    // by the browser when a new track is created for preview. That's why we are disabling all previews.
35
+    const disablePreviews = isIosMobileBrowser() && browser.isVersionGreaterThan('15.3');
36
+
32 37
     const state = toState(stateful);
33 38
     const settings = state['features/base/settings'];
34 39
     const { conference } = state['features/base/conference'];
@@ -64,10 +69,10 @@ export function getDeviceSelectionDialogProps(stateful: Object | Function) {
64 69
         disableVideoInputSelect,
65 70
         hasAudioPermission: permissions.audio,
66 71
         hasVideoPermission: permissions.video,
67
-        hideAudioInputPreview: disableAudioInputChange || !JitsiMeetJS.isCollectingLocalStats(),
68
-        hideAudioOutputPreview: !speakerChangeSupported,
72
+        hideAudioInputPreview: disableAudioInputChange || !JitsiMeetJS.isCollectingLocalStats() || disablePreviews,
73
+        hideAudioOutputPreview: !speakerChangeSupported || disablePreviews,
69 74
         hideAudioOutputSelect: !speakerChangeSupported,
70
-        hideVideoInputPreview: !cameraChangeSupported,
75
+        hideVideoInputPreview: !cameraChangeSupported || disablePreviews,
71 76
         selectedAudioInputId,
72 77
         selectedAudioOutputId,
73 78
         selectedVideoInputId

Laddar…
Avbryt
Spara