Skip to content

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

feat(build,virtual-background) don't use an external bundle for the effect

Saúl Ibarra Corretgé22b6d3217441
diff --git a/Makefile b/Makefile
index 0da02f74a2..7f07f4f2f1 100644
--- a/Makefile
+++ b/Makefile
@@ -51,8 +51,6 @@ deploy-appbundle:
$(OUTPUT_DIR)/analytics-ga.js \
$(BUILD_DIR)/analytics-ga.min.js \
$(BUILD_DIR)/analytics-ga.min.map \
- $(BUILD_DIR)/virtual-background-effect.min.js \
- $(BUILD_DIR)/virtual-background-effect.min.map \
$(BUILD_DIR)/rnnoise-processor.min.js \
$(BUILD_DIR)/rnnoise-processor.min.map \
$(BUILD_DIR)/close3.min.js \
diff --git a/react/features/base/tracks/loadEffects.web.js b/react/features/base/tracks/loadEffects.web.js
index b1eda35aa6..ac445eb925 100644
--- a/react/features/base/tracks/loadEffects.web.js
+++ b/react/features/base/tracks/loadEffects.web.js
@@ -1,7 +1,7 @@
// @flow
import { createScreenshotCaptureEffect } from '../../stream-effects/screenshot-capture';
-import { getBackgroundEffect } from '../../virtual-background';
+import { createVirtualBackgroundEffect } from '../../stream-effects/virtual-background';
import logger from './logger';
@@ -13,9 +13,10 @@ import logger from './logger';
*/
export default function loadEffects(store: Object): Promise<any> {
const state = store.getState();
+ const virtualBackground = state['features/virtual-background'];
- const backgroundPromise = state['features/virtual-background'].backgroundEffectEnabled
- ? getBackgroundEffect()
+ const backgroundPromise = virtualBackground.backgroundEffectEnabled
+ ? createVirtualBackgroundEffect(virtualBackground)
.catch(error => {
logger.error('Failed to obtain the background effect instance with error: ', error);
diff --git a/react/features/virtual-background/actions.js b/react/features/virtual-background/actions.js
index 6667af468c..a04c4b02a5 100644
--- a/react/features/virtual-background/actions.js
+++ b/react/features/virtual-background/actions.js
@@ -1,9 +1,9 @@
// @flow
-import { getLocalVideoTrack } from '../../features/base/tracks';
+import { getLocalVideoTrack } from '../base/tracks';
+import { createVirtualBackgroundEffect } from '../stream-effects/virtual-background';
import { BACKGROUND_ENABLED, SET_VIRTUAL_BACKGROUND } from './actionTypes';
-import { getBackgroundEffect } from './functions';
import logger from './logger';
/**
@@ -21,7 +21,7 @@ export function toggleBackgroundEffect(enabled: boolean) {
try {
if (enabled) {
- await jitsiTrack.setEffect(await getBackgroundEffect(virtualBackground));
+ await jitsiTrack.setEffect(await createVirtualBackgroundEffect(virtualBackground));
dispatch(backgroundEnabled(true));
} else {
await jitsiTrack.setEffect(undefined);
diff --git a/react/features/virtual-background/functions.js b/react/features/virtual-background/functions.js
index 4ef464bb33..caa786213e 100644
--- a/react/features/virtual-background/functions.js
+++ b/react/features/virtual-background/functions.js
@@ -1,27 +1,8 @@
// @flow
-import { getJitsiMeetGlobalNS, loadScript } from '../base/util';
let filterSupport;
-/**
- * Returns promise that resolves with the blur effect instance.
- *
- * @param {Object} virtualBackground - The virtual object that contains the background image source and
- * the isVirtualBackground flag that indicates if virtual image is activated .
- * @returns {Promise<JitsiStreamBackgroundEffect>} - Resolves with the background effect instance.
- */
-export function getBackgroundEffect(virtualBackground: Object) {
- const ns = getJitsiMeetGlobalNS();
-
- if (ns.effects && ns.effects.createVirtualBackgroundEffect) {
- return ns.effects.createVirtualBackgroundEffect(virtualBackground);
- }
-
- return loadScript('libs/virtual-background-effect.min.js').then(() =>
- ns.effects.createVirtualBackgroundEffect(virtualBackground));
-}
-
/**
* Checks context filter support.
*
diff --git a/webpack.config.js b/webpack.config.js
index ede3054bf0..bee4677057 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -247,19 +247,6 @@ module.exports = [
// and sourceMapFilename parameters which target libs without .min in dev
// mode. Thus we change these modules to have the same filename in both
// prod and dev mode.
- Object.assign({}, config, {
- entry: {
- 'virtual-background-effect': './react/features/stream-effects/virtual-background/index.js'
- },
- output: Object.assign({}, config.output, {
- library: [ 'JitsiMeetJS', 'app', 'effects' ],
- libraryTarget: 'window',
- filename: '[name].min.js',
- sourceMapFilename: '[name].min.map'
- }),
- performance: getPerformanceHints(1 * 1024 * 1024)
- }),
-
Object.assign({}, config, {
entry: {
'rnnoise-processor': './react/features/stream-effects/rnnoise/index.js'