Kaynağa Gözat

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.
j8
Saúl Ibarra Corretgé 4 yıl önce
ebeveyn
işleme
22b6d32174

+ 0
- 2
Makefile Dosyayı Görüntüle

@@ -51,8 +51,6 @@ deploy-appbundle:
51 51
 		$(OUTPUT_DIR)/analytics-ga.js \
52 52
 		$(BUILD_DIR)/analytics-ga.min.js \
53 53
 		$(BUILD_DIR)/analytics-ga.min.map \
54
-		$(BUILD_DIR)/virtual-background-effect.min.js \
55
-		$(BUILD_DIR)/virtual-background-effect.min.map \
56 54
 		$(BUILD_DIR)/rnnoise-processor.min.js \
57 55
 		$(BUILD_DIR)/rnnoise-processor.min.map \
58 56
 		$(BUILD_DIR)/close3.min.js \

+ 4
- 3
react/features/base/tracks/loadEffects.web.js Dosyayı Görüntüle

@@ -1,7 +1,7 @@
1 1
 // @flow
2 2
 
3 3
 import { createScreenshotCaptureEffect } from '../../stream-effects/screenshot-capture';
4
-import { getBackgroundEffect } from '../../virtual-background';
4
+import { createVirtualBackgroundEffect } from '../../stream-effects/virtual-background';
5 5
 
6 6
 import logger from './logger';
7 7
 
@@ -13,9 +13,10 @@ import logger from './logger';
13 13
  */
14 14
 export default function loadEffects(store: Object): Promise<any> {
15 15
     const state = store.getState();
16
+    const virtualBackground = state['features/virtual-background'];
16 17
 
17
-    const backgroundPromise = state['features/virtual-background'].backgroundEffectEnabled
18
-        ? getBackgroundEffect()
18
+    const backgroundPromise = virtualBackground.backgroundEffectEnabled
19
+        ? createVirtualBackgroundEffect(virtualBackground)
19 20
             .catch(error => {
20 21
                 logger.error('Failed to obtain the background effect instance with error: ', error);
21 22
 

+ 3
- 3
react/features/virtual-background/actions.js Dosyayı Görüntüle

@@ -1,9 +1,9 @@
1 1
 // @flow
2 2
 
3
-import { getLocalVideoTrack } from '../../features/base/tracks';
3
+import { getLocalVideoTrack } from '../base/tracks';
4
+import { createVirtualBackgroundEffect } from '../stream-effects/virtual-background';
4 5
 
5 6
 import { BACKGROUND_ENABLED, SET_VIRTUAL_BACKGROUND } from './actionTypes';
6
-import { getBackgroundEffect } from './functions';
7 7
 import logger from './logger';
8 8
 
9 9
 /**
@@ -21,7 +21,7 @@ export function toggleBackgroundEffect(enabled: boolean) {
21 21
 
22 22
         try {
23 23
             if (enabled) {
24
-                await jitsiTrack.setEffect(await getBackgroundEffect(virtualBackground));
24
+                await jitsiTrack.setEffect(await createVirtualBackgroundEffect(virtualBackground));
25 25
                 dispatch(backgroundEnabled(true));
26 26
             } else {
27 27
                 await jitsiTrack.setEffect(undefined);

+ 0
- 19
react/features/virtual-background/functions.js Dosyayı Görüntüle

@@ -1,27 +1,8 @@
1 1
 // @flow
2 2
 
3
-import { getJitsiMeetGlobalNS, loadScript } from '../base/util';
4 3
 
5 4
 let filterSupport;
6 5
 
7
-/**
8
- * Returns promise that resolves with the blur effect instance.
9
- *
10
- * @param {Object} virtualBackground - The virtual object that contains the background image source and
11
- * the isVirtualBackground flag that indicates if virtual image is activated .
12
- * @returns {Promise<JitsiStreamBackgroundEffect>} - Resolves with the background effect instance.
13
- */
14
-export function getBackgroundEffect(virtualBackground: Object) {
15
-    const ns = getJitsiMeetGlobalNS();
16
-
17
-    if (ns.effects && ns.effects.createVirtualBackgroundEffect) {
18
-        return ns.effects.createVirtualBackgroundEffect(virtualBackground);
19
-    }
20
-
21
-    return loadScript('libs/virtual-background-effect.min.js').then(() =>
22
-        ns.effects.createVirtualBackgroundEffect(virtualBackground));
23
-}
24
-
25 6
 /**
26 7
  * Checks context filter support.
27 8
  *

+ 0
- 13
webpack.config.js Dosyayı Görüntüle

@@ -247,19 +247,6 @@ module.exports = [
247 247
     // and sourceMapFilename parameters which target libs without .min in dev
248 248
     // mode. Thus we change these modules to have the same filename in both
249 249
     // prod and dev mode.
250
-    Object.assign({}, config, {
251
-        entry: {
252
-            'virtual-background-effect': './react/features/stream-effects/virtual-background/index.js'
253
-        },
254
-        output: Object.assign({}, config.output, {
255
-            library: [ 'JitsiMeetJS', 'app', 'effects' ],
256
-            libraryTarget: 'window',
257
-            filename: '[name].min.js',
258
-            sourceMapFilename: '[name].min.map'
259
-        }),
260
-        performance: getPerformanceHints(1 * 1024 * 1024)
261
-    }),
262
-
263 250
     Object.assign({}, config, {
264 251
         entry: {
265 252
             'rnnoise-processor': './react/features/stream-effects/rnnoise/index.js'

Loading…
İptal
Kaydet