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(blur): when switching video tracks.

Hristo Terezovf030a3f1fb54
diff --git a/conference.js b/conference.js
index 12f134084b..92c54c5ce8 100644
--- a/conference.js
+++ b/conference.js
@@ -106,7 +106,6 @@ import {
trackRemoved
} from './react/features/base/tracks';
import { getJitsiMeetGlobalNS } from './react/features/base/util';
-import { getBlurEffect } from './react/features/blur';
import { addMessage } from './react/features/chat';
import { showDesktopPicker } from './react/features/desktop-picker';
import { appendSuffix } from './react/features/display-name';
@@ -560,63 +559,47 @@ export default {
// Resolve with no tracks
tryCreateLocalTracks = Promise.resolve([]);
} else {
- const loadEffectsPromise = options.startWithBlurEnabled
- ? getBlurEffect()
- .then(blurEffect => [ blurEffect ])
- .catch(error => {
- logger.error('Failed to obtain the blur effect instance with error: ', error);
-
- return Promise.resolve([]);
- })
- : Promise.resolve([]);
-
- tryCreateLocalTracks = loadEffectsPromise.then(trackEffects =>
- createLocalTracksF(
- {
- devices: initialDevices,
- effects: trackEffects
- }, true)
- .catch(err => {
- if (requestedAudio && requestedVideo) {
-
- // Try audio only...
- audioAndVideoError = err;
-
- return (
- createLocalTracksF({ devices: [ 'audio' ] }, true));
- } else if (requestedAudio && !requestedVideo) {
- audioOnlyError = err;
+ tryCreateLocalTracks = createLocalTracksF({ devices: initialDevices }, true)
+ .catch(err => {
+ if (requestedAudio && requestedVideo) {
- return [];
- } else if (requestedVideo && !requestedAudio) {
- videoOnlyError = err;
+ // Try audio only...
+ audioAndVideoError = err;
- return [];
- }
- logger.error('Should never happen');
- })
- .catch(err => {
- // Log this just in case...
- if (!requestedAudio) {
- logger.error('The impossible just happened', err);
- }
+ return (
+ createLocalTracksF({ devices: [ 'audio' ] }, true));
+ } else if (requestedAudio && !requestedVideo) {
audioOnlyError = err;
- // Try video only...
- return requestedVideo
- ? createLocalTracksF({ devices: [ 'video' ] }, true)
- : [];
- })
- .catch(err => {
- // Log this just in case...
- if (!requestedVideo) {
- logger.error('The impossible just happened', err);
- }
+ return [];
+ } else if (requestedVideo && !requestedAudio) {
videoOnlyError = err;
return [];
- })
- );
+ }
+ logger.error('Should never happen');
+ })
+ .catch(err => {
+ // Log this just in case...
+ if (!requestedAudio) {
+ logger.error('The impossible just happened', err);
+ }
+ audioOnlyError = err;
+
+ // Try video only...
+ return requestedVideo
+ ? createLocalTracksF({ devices: [ 'video' ] }, true)
+ : [];
+ })
+ .catch(err => {
+ // Log this just in case...
+ if (!requestedVideo) {
+ logger.error('The impossible just happened', err);
+ }
+ videoOnlyError = err;
+
+ return [];
+ });
}
// Hide the permissions prompt/overlay as soon as the tracks are
@@ -678,7 +661,6 @@ export default {
'initial device list initialization failed', error))
.then(() => this.createInitialLocalTracksAndConnect(
options.roomName, {
- startWithBlurEnabled: APP.store.getState()['features/blur'].blurEnabled,
startAudioOnly: config.startAudioOnly,
startScreenSharing: config.startScreenSharing,
startWithAudioMuted: config.startWithAudioMuted || config.startSilent,
diff --git a/react/features/base/tracks/functions.js b/react/features/base/tracks/functions.js
index 76d03b2851..da437b823d 100644
--- a/react/features/base/tracks/functions.js
+++ b/react/features/base/tracks/functions.js
@@ -1,5 +1,6 @@
/* global APP */
+import { getBlurEffect } from '../../blur';
import JitsiMeetJS, { JitsiTrackErrors } from '../lib-jitsi-meet';
import { MEDIA_TYPE } from '../media';
import {
@@ -50,38 +51,49 @@ export function createLocalTracksF(
}
}
+ const state = store.getState();
const {
constraints,
desktopSharingFrameRate,
firefox_fake_device, // eslint-disable-line camelcase
resolution
- } = store.getState()['features/base/config'];
+ } = state['features/base/config'];
+ const loadEffectsPromise = state['features/blur'].blurEnabled
+ ? getBlurEffect()
+ .then(blurEffect => [ blurEffect ])
+ .catch(error => {
+ logger.error('Failed to obtain the blur effect instance with error: ', error);
+
+ return Promise.resolve([]);
+ })
+ : Promise.resolve([]);
return (
- JitsiMeetJS.createLocalTracks(
- {
- cameraDeviceId,
- constraints,
- desktopSharingExtensionExternalInstallation:
- options.desktopSharingExtensionExternalInstallation,
- desktopSharingFrameRate,
- desktopSharingSourceDevice:
- options.desktopSharingSourceDevice,
- desktopSharingSources: options.desktopSharingSources,
-
- // Copy array to avoid mutations inside library.
- devices: options.devices.slice(0),
- effects: options.effects,
- firefox_fake_device, // eslint-disable-line camelcase
- micDeviceId,
- resolution
- },
- firePermissionPromptIsShownEvent)
- .catch(err => {
- logger.error('Failed to create local tracks', options.devices, err);
-
- return Promise.reject(err);
- }));
+ loadEffectsPromise.then(effects =>
+ JitsiMeetJS.createLocalTracks(
+ {
+ cameraDeviceId,
+ constraints,
+ desktopSharingExtensionExternalInstallation:
+ options.desktopSharingExtensionExternalInstallation,
+ desktopSharingFrameRate,
+ desktopSharingSourceDevice:
+ options.desktopSharingSourceDevice,
+ desktopSharingSources: options.desktopSharingSources,
+
+ // Copy array to avoid mutations inside library.
+ devices: options.devices.slice(0),
+ effects,
+ firefox_fake_device, // eslint-disable-line camelcase
+ micDeviceId,
+ resolution
+ },
+ firePermissionPromptIsShownEvent)
+ .catch(err => {
+ logger.error('Failed to create local tracks', options.devices, err);
+
+ return Promise.reject(err);
+ })));
}
/**