feat(build,virtual-background) don't use an external bundle for the effect
The majority of the code is in the WASM file and models, this is just a few KB. It's so little, in fact, that the performance hint for the main bundle didn't have to be adjusted.
This commit is contained in:
parent
31ace267ce
commit
22b6d32174
2
Makefile
2
Makefile
|
@ -51,8 +51,6 @@ deploy-appbundle:
|
||||||
$(OUTPUT_DIR)/analytics-ga.js \
|
$(OUTPUT_DIR)/analytics-ga.js \
|
||||||
$(BUILD_DIR)/analytics-ga.min.js \
|
$(BUILD_DIR)/analytics-ga.min.js \
|
||||||
$(BUILD_DIR)/analytics-ga.min.map \
|
$(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.js \
|
||||||
$(BUILD_DIR)/rnnoise-processor.min.map \
|
$(BUILD_DIR)/rnnoise-processor.min.map \
|
||||||
$(BUILD_DIR)/close3.min.js \
|
$(BUILD_DIR)/close3.min.js \
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import { createScreenshotCaptureEffect } from '../../stream-effects/screenshot-capture';
|
import { createScreenshotCaptureEffect } from '../../stream-effects/screenshot-capture';
|
||||||
import { getBackgroundEffect } from '../../virtual-background';
|
import { createVirtualBackgroundEffect } from '../../stream-effects/virtual-background';
|
||||||
|
|
||||||
import logger from './logger';
|
import logger from './logger';
|
||||||
|
|
||||||
|
@ -13,9 +13,10 @@ import logger from './logger';
|
||||||
*/
|
*/
|
||||||
export default function loadEffects(store: Object): Promise<any> {
|
export default function loadEffects(store: Object): Promise<any> {
|
||||||
const state = store.getState();
|
const state = store.getState();
|
||||||
|
const virtualBackground = state['features/virtual-background'];
|
||||||
|
|
||||||
const backgroundPromise = state['features/virtual-background'].backgroundEffectEnabled
|
const backgroundPromise = virtualBackground.backgroundEffectEnabled
|
||||||
? getBackgroundEffect()
|
? createVirtualBackgroundEffect(virtualBackground)
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
logger.error('Failed to obtain the background effect instance with error: ', error);
|
logger.error('Failed to obtain the background effect instance with error: ', error);
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
// @flow
|
// @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 { BACKGROUND_ENABLED, SET_VIRTUAL_BACKGROUND } from './actionTypes';
|
||||||
import { getBackgroundEffect } from './functions';
|
|
||||||
import logger from './logger';
|
import logger from './logger';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -21,7 +21,7 @@ export function toggleBackgroundEffect(enabled: boolean) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
await jitsiTrack.setEffect(await getBackgroundEffect(virtualBackground));
|
await jitsiTrack.setEffect(await createVirtualBackgroundEffect(virtualBackground));
|
||||||
dispatch(backgroundEnabled(true));
|
dispatch(backgroundEnabled(true));
|
||||||
} else {
|
} else {
|
||||||
await jitsiTrack.setEffect(undefined);
|
await jitsiTrack.setEffect(undefined);
|
||||||
|
|
|
@ -1,27 +1,8 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import { getJitsiMeetGlobalNS, loadScript } from '../base/util';
|
|
||||||
|
|
||||||
let filterSupport;
|
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.
|
* Checks context filter support.
|
||||||
*
|
*
|
||||||
|
|
|
@ -247,19 +247,6 @@ module.exports = [
|
||||||
// and sourceMapFilename parameters which target libs without .min in dev
|
// and sourceMapFilename parameters which target libs without .min in dev
|
||||||
// mode. Thus we change these modules to have the same filename in both
|
// mode. Thus we change these modules to have the same filename in both
|
||||||
// prod and dev mode.
|
// 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, {
|
Object.assign({}, config, {
|
||||||
entry: {
|
entry: {
|
||||||
'rnnoise-processor': './react/features/stream-effects/rnnoise/index.js'
|
'rnnoise-processor': './react/features/stream-effects/rnnoise/index.js'
|
||||||
|
|
Loading…
Reference in New Issue