Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
fix(video-select): remove video preview from device selection and fix video switch on mobile browsers (#13780)
Gabriel Borleadf3ef0d89547
diff --git a/react/features/base/devices/middleware.web.ts b/react/features/base/devices/middleware.web.tsindex 3e9c6149f0..dfe4e8f8a2 100644--- a/react/features/base/devices/middleware.web.ts+++ b/react/features/base/devices/middleware.web.ts@@ -9,10 +9,12 @@ import { NOTIFICATION_TIMEOUT_TYPE } from '../../notifications/constants';import { replaceAudioTrackById, replaceVideoTrackById, setDeviceStatusWarning } from '../../prejoin/actions';import { isPrejoinPageVisible } from '../../prejoin/functions';import { APP_WILL_MOUNT, APP_WILL_UNMOUNT } from '../app/actionTypes';+import { isMobileBrowser } from '../environment/utils';import JitsiMeetJS, { JitsiMediaDevicesEvents, JitsiTrackErrors } from '../lib-jitsi-meet';+import { MEDIA_TYPE } from '../media/constants';import MiddlewareRegistry from '../redux/MiddlewareRegistry';import { updateSettings } from '../settings/actions';-+import { getLocalTrack } from '../tracks/functions';import {CHECK_AND_NOTIFY_FOR_NEW_DEVICE,@@ -182,13 +184,20 @@ MiddlewareRegistry.register(store => next => action => {APP.UI.emitEvent(UIEvents.AUDIO_DEVICE_CHANGED, action.deviceId);}break;- case SET_VIDEO_INPUT_DEVICE:+ case SET_VIDEO_INPUT_DEVICE: {+ const localTrack = getLocalTrack(store.getState()['features/base/tracks'], MEDIA_TYPE.VIDEO);++ // on mobile devices the video stream has to be stopped before replacing it+ if (isMobileBrowser() && localTrack && !localTrack.muted) {+ localTrack.jitsiTrack.stopStream();+ }if (isPrejoinPageVisible(store.getState())) {store.dispatch(replaceVideoTrackById(action.deviceId));} else {APP.UI.emitEvent(UIEvents.VIDEO_DEVICE_CHANGED, action.deviceId);}break;+ }case UPDATE_DEVICE_LIST:logDeviceList(groupDevicesByKind(action.devices));if (areDeviceLabelsInitialized(store.getState())) {diff --git a/react/features/base/environment/utils.ts b/react/features/base/environment/utils.tsindex 6d26062cbe..b3dec92284 100644--- a/react/features/base/environment/utils.ts+++ b/react/features/base/environment/utils.ts@@ -18,3 +18,4 @@ export function isMobileBrowser() {export function isIosMobileBrowser() {return Platform.OS === 'ios';}+diff --git a/react/features/device-selection/actions.web.ts b/react/features/device-selection/actions.web.tsindex 6dd2899759..fd150a28b6 100644--- a/react/features/device-selection/actions.web.ts+++ b/react/features/device-selection/actions.web.ts@@ -79,10 +79,8 @@ export function submitVideoDeviceSelectionTab(newState: any, isDisplayedOnWelcomuserSelectedCameraDeviceLabel:getDeviceLabelById(getState(), newState.selectedVideoInputId, 'videoInput')}));-dispatch(setVideoInputDevice(newState.selectedVideoInputId));}-if (newState.localFlipX !== currentState.localFlipX) {dispatch(updateSettings({localFlipX: newState.localFlipXdiff --git a/react/features/device-selection/functions.web.ts b/react/features/device-selection/functions.web.tsindex f86efb8605..52b4cd6428 100644--- a/react/features/device-selection/functions.web.ts+++ b/react/features/device-selection/functions.web.ts@@ -14,7 +14,7 @@ import {getDeviceIdByLabel,groupDevicesByKind} from '../base/devices/functions.web';-import { isIosMobileBrowser } from '../base/environment/utils';+import { isIosMobileBrowser, isMobileBrowser } from '../base/environment/utils';import JitsiMeetJS from '../base/lib-jitsi-meet';import { toState } from '../base/redux/functions';import {@@ -97,7 +97,7 @@ export function getAudioDeviceSelectionDialogProps(stateful: IStateful, isDisplaexport function getVideoDeviceSelectionDialogProps(stateful: IStateful, isDisplayedOnWelcomePage: boolean) {// 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();+ const disablePreviews = isMobileBrowser();const state = toState(stateful);const settings = state['features/base/settings'];