Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

fix(device-selection):iOS Safari disable previews

Hristo Terezov8cd259c43f7c
diff --git a/react/features/device-selection/actions.js b/react/features/device-selection/actions.js
index f1edb48d21..64de72649c 100644
--- a/react/features/device-selection/actions.js
+++ b/react/features/device-selection/actions.js
@@ -5,8 +5,6 @@ import {
setAudioOutputDeviceId,
setVideoInputDevice
} from '../base/devices';
-import { isIosMobileBrowser } from '../base/environment/utils';
-import { browser } from '../base/lib-jitsi-meet';
import { updateSettings } from '../base/settings';
import { getDeviceSelectionDialogProps } from './functions';
@@ -19,16 +17,10 @@ import logger from './logger';
* @returns {Function}
*/
export function submitDeviceSelectionTab(newState) {
- // Always use the new track for mobile Safari because of https://bugs.webkit.org/show_bug.cgi?id=179363#c30. The
- // old track is stopped by the browser when a new track is created for preview so it needs to be replaced even if
- // the device selection doesn't change.
- const replaceTrackAlways = isIosMobileBrowser() && browser.isVersionGreaterThan('15.3');
-
return (dispatch, getState) => {
const currentState = getDeviceSelectionDialogProps(getState());
- if ((newState.selectedVideoInputId && (newState.selectedVideoInputId !== currentState.selectedVideoInputId))
- || replaceTrackAlways) {
+ if (newState.selectedVideoInputId && (newState.selectedVideoInputId !== currentState.selectedVideoInputId)) {
dispatch(updateSettings({
userSelectedCameraDeviceId: newState.selectedVideoInputId,
userSelectedCameraDeviceLabel:
@@ -38,8 +30,7 @@ export function submitDeviceSelectionTab(newState) {
dispatch(setVideoInputDevice(newState.selectedVideoInputId));
}
- if ((newState.selectedAudioInputId && newState.selectedAudioInputId !== currentState.selectedAudioInputId)
- || replaceTrackAlways) {
+ if (newState.selectedAudioInputId && newState.selectedAudioInputId !== currentState.selectedAudioInputId) {
dispatch(updateSettings({
userSelectedMicDeviceId: newState.selectedAudioInputId,
userSelectedMicDeviceLabel:
diff --git a/react/features/device-selection/functions.js b/react/features/device-selection/functions.js
index 2d9abd3187..0464949f7f 100644
--- a/react/features/device-selection/functions.js
+++ b/react/features/device-selection/functions.js
@@ -13,7 +13,8 @@ import {
setAudioOutputDevice,
setVideoInputDeviceAndUpdateSettings
} from '../base/devices';
-import JitsiMeetJS from '../base/lib-jitsi-meet';
+import { isIosMobileBrowser } from '../base/environment/utils';
+import JitsiMeetJS, { browser } from '../base/lib-jitsi-meet';
import { toState } from '../base/redux';
import {
getUserSelectedCameraDeviceId,
@@ -29,6 +30,10 @@ import {
* @returns {Object} - The properties for the device selection dialog.
*/
export function getDeviceSelectionDialogProps(stateful: Object | Function) {
+ // On mobile Safari because of https://bugs.webkit.org/show_bug.cgi?id=179363#c30, the old track is stopped
+ // by the browser when a new track is created for preview. That's why we are disabling all previews.
+ const disablePreviews = isIosMobileBrowser() && browser.isVersionGreaterThan('15.3');
+
const state = toState(stateful);
const settings = state['features/base/settings'];
const { conference } = state['features/base/conference'];
@@ -64,10 +69,10 @@ export function getDeviceSelectionDialogProps(stateful: Object | Function) {
disableVideoInputSelect,
hasAudioPermission: permissions.audio,
hasVideoPermission: permissions.video,
- hideAudioInputPreview: disableAudioInputChange || !JitsiMeetJS.isCollectingLocalStats(),
- hideAudioOutputPreview: !speakerChangeSupported,
+ hideAudioInputPreview: disableAudioInputChange || !JitsiMeetJS.isCollectingLocalStats() || disablePreviews,
+ hideAudioOutputPreview: !speakerChangeSupported || disablePreviews,
hideAudioOutputSelect: !speakerChangeSupported,
- hideVideoInputPreview: !cameraChangeSupported,
+ hideVideoInputPreview: !cameraChangeSupported || disablePreviews,
selectedAudioInputId,
selectedAudioOutputId,
selectedVideoInputId