@100mslive/roomkit-react 0.3.19-alpha.4 → 0.3.19-alpha.6
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/{HLSView-LMQPPX5V.js → HLSView-2P2FVCEW.js} +2 -2
- package/dist/{HLSView-IQOQUTLY.css → HLSView-GRUKIJTY.css} +3 -3
- package/dist/{HLSView-IQOQUTLY.css.map → HLSView-GRUKIJTY.css.map} +1 -1
- package/dist/Prebuilt/components/VirtualBackground/VBCollection.d.ts +1 -1
- package/dist/Prebuilt/components/VirtualBackground/VBHandler.d.ts +5 -6
- package/dist/{chunk-FZNVIKYB.js → chunk-KZIOZDJV.js} +77 -64
- package/dist/{chunk-FZNVIKYB.js.map → chunk-KZIOZDJV.js.map} +3 -3
- package/dist/index.cjs.css +2 -2
- package/dist/index.cjs.css.map +1 -1
- package/dist/index.cjs.js +72 -59
- package/dist/index.cjs.js.map +4 -4
- package/dist/index.css +2 -2
- package/dist/index.css.map +1 -1
- package/dist/index.js +1 -1
- package/dist/meta.cjs.json +36 -26
- package/dist/meta.esbuild.json +48 -38
- package/package.json +7 -7
- package/src/Prebuilt/components/VirtualBackground/VBCollection.tsx +3 -1
- package/src/Prebuilt/components/VirtualBackground/VBHandler.tsx +14 -4
- package/src/Prebuilt/components/VirtualBackground/VBPicker.tsx +46 -31
- package/src/Prebuilt/components/VirtualBackground/VBToggle.tsx +2 -1
- /package/dist/{HLSView-LMQPPX5V.js.map → HLSView-2P2FVCEW.js.map} +0 -0
package/dist/meta.esbuild.json
CHANGED
@@ -2385,10 +2385,10 @@
|
|
2385
2385
|
"format": "esm"
|
2386
2386
|
},
|
2387
2387
|
"src/Prebuilt/components/VirtualBackground/VBHandler.tsx": {
|
2388
|
-
"bytes":
|
2388
|
+
"bytes": 3223,
|
2389
2389
|
"imports": [
|
2390
2390
|
{
|
2391
|
-
"path": "@100mslive/hms-virtual-background",
|
2391
|
+
"path": "@100mslive/hms-virtual-background/hmsvbplugin",
|
2392
2392
|
"kind": "import-statement",
|
2393
2393
|
"external": true
|
2394
2394
|
},
|
@@ -2397,6 +2397,11 @@
|
|
2397
2397
|
"kind": "import-statement",
|
2398
2398
|
"external": true
|
2399
2399
|
},
|
2400
|
+
{
|
2401
|
+
"path": "@100mslive/hms-virtual-background/hmseffectsplugin",
|
2402
|
+
"kind": "dynamic-import",
|
2403
|
+
"external": true
|
2404
|
+
},
|
2400
2405
|
{
|
2401
2406
|
"path": "<runtime>",
|
2402
2407
|
"kind": "import-statement",
|
@@ -6674,7 +6679,7 @@
|
|
6674
6679
|
"format": "esm"
|
6675
6680
|
},
|
6676
6681
|
"src/Prebuilt/components/VirtualBackground/VBToggle.tsx": {
|
6677
|
-
"bytes":
|
6682
|
+
"bytes": 1831,
|
6678
6683
|
"imports": [
|
6679
6684
|
{
|
6680
6685
|
"path": "react",
|
@@ -6682,7 +6687,7 @@
|
|
6682
6687
|
"external": true
|
6683
6688
|
},
|
6684
6689
|
{
|
6685
|
-
"path": "@100mslive/hms-virtual-background",
|
6690
|
+
"path": "@100mslive/hms-virtual-background/hmsvbplugin",
|
6686
6691
|
"kind": "import-statement",
|
6687
6692
|
"external": true
|
6688
6693
|
},
|
@@ -9919,7 +9924,7 @@
|
|
9919
9924
|
"format": "esm"
|
9920
9925
|
},
|
9921
9926
|
"src/Prebuilt/components/VirtualBackground/VBCollection.tsx": {
|
9922
|
-
"bytes":
|
9927
|
+
"bytes": 1590,
|
9923
9928
|
"imports": [
|
9924
9929
|
{
|
9925
9930
|
"path": "react",
|
@@ -9927,7 +9932,7 @@
|
|
9927
9932
|
"external": true
|
9928
9933
|
},
|
9929
9934
|
{
|
9930
|
-
"path": "@100mslive/hms-virtual-background",
|
9935
|
+
"path": "@100mslive/hms-virtual-background/hmsvbplugin",
|
9931
9936
|
"kind": "import-statement",
|
9932
9937
|
"external": true
|
9933
9938
|
},
|
@@ -9960,7 +9965,7 @@
|
|
9960
9965
|
"format": "esm"
|
9961
9966
|
},
|
9962
9967
|
"src/Prebuilt/components/VirtualBackground/VBPicker.tsx": {
|
9963
|
-
"bytes":
|
9968
|
+
"bytes": 8800,
|
9964
9969
|
"imports": [
|
9965
9970
|
{
|
9966
9971
|
"path": "react",
|
@@ -9978,7 +9983,7 @@
|
|
9978
9983
|
"original": "@100mslive/hms-video-store"
|
9979
9984
|
},
|
9980
9985
|
{
|
9981
|
-
"path": "@100mslive/hms-virtual-background",
|
9986
|
+
"path": "@100mslive/hms-virtual-background/hmsvbplugin",
|
9982
9987
|
"kind": "import-statement",
|
9983
9988
|
"external": true
|
9984
9989
|
},
|
@@ -11287,7 +11292,7 @@
|
|
11287
11292
|
],
|
11288
11293
|
"format": "esm"
|
11289
11294
|
},
|
11290
|
-
"../../../../../../../tmp/tmp-
|
11295
|
+
"../../../../../../../tmp/tmp-2864-zIyGbz3XurZj/191b1a067c52/tldraw.css": {
|
11291
11296
|
"bytes": 80111,
|
11292
11297
|
"imports": [
|
11293
11298
|
{
|
@@ -11337,7 +11342,7 @@
|
|
11337
11342
|
}
|
11338
11343
|
]
|
11339
11344
|
},
|
11340
|
-
"../../../../../../../tmp/tmp-
|
11345
|
+
"../../../../../../../tmp/tmp-2864-zIyGbz3XurZj/191b1a067570/index.css": {
|
11341
11346
|
"bytes": 597,
|
11342
11347
|
"imports": [
|
11343
11348
|
{
|
@@ -11346,7 +11351,7 @@
|
|
11346
11351
|
"external": true
|
11347
11352
|
},
|
11348
11353
|
{
|
11349
|
-
"path": "../../../../../../../tmp/tmp-
|
11354
|
+
"path": "../../../../../../../tmp/tmp-2864-zIyGbz3XurZj/191b1a067c52/tldraw.css",
|
11350
11355
|
"kind": "import-rule",
|
11351
11356
|
"original": "@tldraw/tldraw/tldraw.css"
|
11352
11357
|
}
|
@@ -11421,7 +11426,7 @@
|
|
11421
11426
|
"original": "../../common/constants"
|
11422
11427
|
},
|
11423
11428
|
{
|
11424
|
-
"path": "../../../../../../../tmp/tmp-
|
11429
|
+
"path": "../../../../../../../tmp/tmp-2864-zIyGbz3XurZj/191b1a067570/index.css",
|
11425
11430
|
"kind": "import-statement",
|
11426
11431
|
"original": "@100mslive/hms-whiteboard/index.css"
|
11427
11432
|
},
|
@@ -15409,7 +15414,7 @@
|
|
15409
15414
|
"dist/index.js": {
|
15410
15415
|
"imports": [
|
15411
15416
|
{
|
15412
|
-
"path": "dist/chunk-
|
15417
|
+
"path": "dist/chunk-KZIOZDJV.js",
|
15413
15418
|
"kind": "import-statement"
|
15414
15419
|
}
|
15415
15420
|
],
|
@@ -15485,16 +15490,16 @@
|
|
15485
15490
|
"inputs": {},
|
15486
15491
|
"bytes": 1882
|
15487
15492
|
},
|
15488
|
-
"dist/HLSView-
|
15493
|
+
"dist/HLSView-2P2FVCEW.js.map": {
|
15489
15494
|
"imports": [],
|
15490
15495
|
"exports": [],
|
15491
15496
|
"inputs": {},
|
15492
15497
|
"bytes": 100275
|
15493
15498
|
},
|
15494
|
-
"dist/HLSView-
|
15499
|
+
"dist/HLSView-2P2FVCEW.js": {
|
15495
15500
|
"imports": [
|
15496
15501
|
{
|
15497
|
-
"path": "dist/chunk-
|
15502
|
+
"path": "dist/chunk-KZIOZDJV.js",
|
15498
15503
|
"kind": "import-statement"
|
15499
15504
|
},
|
15500
15505
|
{
|
@@ -15672,7 +15677,7 @@
|
|
15672
15677
|
"default"
|
15673
15678
|
],
|
15674
15679
|
"entryPoint": "src/Prebuilt/layouts/HLSView.jsx",
|
15675
|
-
"cssBundle": "dist/HLSView-
|
15680
|
+
"cssBundle": "dist/HLSView-GRUKIJTY.css",
|
15676
15681
|
"inputs": {
|
15677
15682
|
"src/Prebuilt/layouts/HLSView.jsx": {
|
15678
15683
|
"bytesInOutput": 27671
|
@@ -15731,13 +15736,13 @@
|
|
15731
15736
|
},
|
15732
15737
|
"bytes": 61702
|
15733
15738
|
},
|
15734
|
-
"dist/chunk-
|
15739
|
+
"dist/chunk-KZIOZDJV.js.map": {
|
15735
15740
|
"imports": [],
|
15736
15741
|
"exports": [],
|
15737
15742
|
"inputs": {},
|
15738
|
-
"bytes":
|
15743
|
+
"bytes": 3518013
|
15739
15744
|
},
|
15740
|
-
"dist/chunk-
|
15745
|
+
"dist/chunk-KZIOZDJV.js": {
|
15741
15746
|
"imports": [
|
15742
15747
|
{
|
15743
15748
|
"path": "react",
|
@@ -16190,10 +16195,15 @@
|
|
16190
16195
|
"external": true
|
16191
16196
|
},
|
16192
16197
|
{
|
16193
|
-
"path": "@100mslive/hms-virtual-background",
|
16198
|
+
"path": "@100mslive/hms-virtual-background/hmsvbplugin",
|
16194
16199
|
"kind": "import-statement",
|
16195
16200
|
"external": true
|
16196
16201
|
},
|
16202
|
+
{
|
16203
|
+
"path": "@100mslive/hms-virtual-background/hmseffectsplugin",
|
16204
|
+
"kind": "dynamic-import",
|
16205
|
+
"external": true
|
16206
|
+
},
|
16197
16207
|
{
|
16198
16208
|
"path": "react",
|
16199
16209
|
"kind": "import-statement",
|
@@ -17085,7 +17095,7 @@
|
|
17085
17095
|
"external": true
|
17086
17096
|
},
|
17087
17097
|
{
|
17088
|
-
"path": "@100mslive/hms-virtual-background",
|
17098
|
+
"path": "@100mslive/hms-virtual-background/hmsvbplugin",
|
17089
17099
|
"kind": "import-statement",
|
17090
17100
|
"external": true
|
17091
17101
|
},
|
@@ -17900,7 +17910,7 @@
|
|
17900
17910
|
"external": true
|
17901
17911
|
},
|
17902
17912
|
{
|
17903
|
-
"path": "@100mslive/hms-virtual-background",
|
17913
|
+
"path": "@100mslive/hms-virtual-background/hmsvbplugin",
|
17904
17914
|
"kind": "import-statement",
|
17905
17915
|
"external": true
|
17906
17916
|
},
|
@@ -17925,7 +17935,7 @@
|
|
17925
17935
|
"external": true
|
17926
17936
|
},
|
17927
17937
|
{
|
17928
|
-
"path": "@100mslive/hms-virtual-background",
|
17938
|
+
"path": "@100mslive/hms-virtual-background/hmsvbplugin",
|
17929
17939
|
"kind": "import-statement",
|
17930
17940
|
"external": true
|
17931
17941
|
},
|
@@ -18275,7 +18285,7 @@
|
|
18275
18285
|
"external": true
|
18276
18286
|
},
|
18277
18287
|
{
|
18278
|
-
"path": "dist/HLSView-
|
18288
|
+
"path": "dist/HLSView-2P2FVCEW.js",
|
18279
18289
|
"kind": "dynamic-import"
|
18280
18290
|
},
|
18281
18291
|
{
|
@@ -18894,7 +18904,7 @@
|
|
18894
18904
|
],
|
18895
18905
|
"inputs": {
|
18896
18906
|
"<define:process.env>": {
|
18897
|
-
"bytesInOutput":
|
18907
|
+
"bytesInOutput": 18005
|
18898
18908
|
},
|
18899
18909
|
"../../node_modules/lodash/lodash.js": {
|
18900
18910
|
"bytesInOutput": 224301
|
@@ -19230,7 +19240,7 @@
|
|
19230
19240
|
"bytesInOutput": 2781
|
19231
19241
|
},
|
19232
19242
|
"src/Prebuilt/components/VirtualBackground/VBHandler.tsx": {
|
19233
|
-
"bytesInOutput":
|
19243
|
+
"bytesInOutput": 3794
|
19234
19244
|
},
|
19235
19245
|
"src/Prebuilt/components/hooks/useRedirectToLeave.tsx": {
|
19236
19246
|
"bytesInOutput": 489
|
@@ -19521,7 +19531,7 @@
|
|
19521
19531
|
"bytesInOutput": 823
|
19522
19532
|
},
|
19523
19533
|
"src/Prebuilt/components/VirtualBackground/VBToggle.tsx": {
|
19524
|
-
"bytesInOutput":
|
19534
|
+
"bytesInOutput": 1817
|
19525
19535
|
},
|
19526
19536
|
"src/Prebuilt/components/Footer/ChatToggle.tsx": {
|
19527
19537
|
"bytesInOutput": 1564
|
@@ -19713,13 +19723,13 @@
|
|
19713
19723
|
"bytesInOutput": 1050
|
19714
19724
|
},
|
19715
19725
|
"src/Prebuilt/components/VirtualBackground/VBPicker.tsx": {
|
19716
|
-
"bytesInOutput":
|
19726
|
+
"bytesInOutput": 8570
|
19717
19727
|
},
|
19718
19728
|
"src/Prebuilt/components/VirtualBackground/util.tsx": {
|
19719
19729
|
"bytesInOutput": 449
|
19720
19730
|
},
|
19721
19731
|
"src/Prebuilt/components/VirtualBackground/VBCollection.tsx": {
|
19722
|
-
"bytesInOutput":
|
19732
|
+
"bytesInOutput": 1252
|
19723
19733
|
},
|
19724
19734
|
"src/Prebuilt/components/VirtualBackground/VBOption.tsx": {
|
19725
19735
|
"bytesInOutput": 1156
|
@@ -19790,7 +19800,7 @@
|
|
19790
19800
|
"src/Prebuilt/components/VideoLayouts/WhiteboardLayout.tsx": {
|
19791
19801
|
"bytesInOutput": 2830
|
19792
19802
|
},
|
19793
|
-
"../../../../../../../tmp/tmp-
|
19803
|
+
"../../../../../../../tmp/tmp-2864-zIyGbz3XurZj/191b1a067570/index.css": {
|
19794
19804
|
"bytesInOutput": 0
|
19795
19805
|
},
|
19796
19806
|
"src/Prebuilt/common/PeersSorter.ts": {
|
@@ -19959,7 +19969,7 @@
|
|
19959
19969
|
"bytesInOutput": 2628
|
19960
19970
|
}
|
19961
19971
|
},
|
19962
|
-
"bytes":
|
19972
|
+
"bytes": 1459098
|
19963
19973
|
},
|
19964
19974
|
"dist/index.css.map": {
|
19965
19975
|
"imports": [],
|
@@ -20021,22 +20031,22 @@
|
|
20021
20031
|
}
|
20022
20032
|
],
|
20023
20033
|
"inputs": {
|
20024
|
-
"../../../../../../../tmp/tmp-
|
20034
|
+
"../../../../../../../tmp/tmp-2864-zIyGbz3XurZj/191b1a067c52/tldraw.css": {
|
20025
20035
|
"bytesInOutput": 75223
|
20026
20036
|
},
|
20027
|
-
"../../../../../../../tmp/tmp-
|
20037
|
+
"../../../../../../../tmp/tmp-2864-zIyGbz3XurZj/191b1a067570/index.css": {
|
20028
20038
|
"bytesInOutput": 401
|
20029
20039
|
}
|
20030
20040
|
},
|
20031
20041
|
"bytes": 75901
|
20032
20042
|
},
|
20033
|
-
"dist/HLSView-
|
20043
|
+
"dist/HLSView-GRUKIJTY.css.map": {
|
20034
20044
|
"imports": [],
|
20035
20045
|
"exports": [],
|
20036
20046
|
"inputs": {},
|
20037
20047
|
"bytes": 122402
|
20038
20048
|
},
|
20039
|
-
"dist/HLSView-
|
20049
|
+
"dist/HLSView-GRUKIJTY.css": {
|
20040
20050
|
"imports": [
|
20041
20051
|
{
|
20042
20052
|
"path": "https://fonts.googleapis.com/css2?family=Inter:wght@400;500&display=swap",
|
@@ -20090,10 +20100,10 @@
|
|
20090
20100
|
}
|
20091
20101
|
],
|
20092
20102
|
"inputs": {
|
20093
|
-
"../../../../../../../tmp/tmp-
|
20103
|
+
"../../../../../../../tmp/tmp-2864-zIyGbz3XurZj/191b1a067c52/tldraw.css": {
|
20094
20104
|
"bytesInOutput": 75223
|
20095
20105
|
},
|
20096
|
-
"../../../../../../../tmp/tmp-
|
20106
|
+
"../../../../../../../tmp/tmp-2864-zIyGbz3XurZj/191b1a067570/index.css": {
|
20097
20107
|
"bytesInOutput": 401
|
20098
20108
|
}
|
20099
20109
|
},
|
package/package.json
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
"prebuilt",
|
11
11
|
"roomkit"
|
12
12
|
],
|
13
|
-
"version": "0.3.19-alpha.
|
13
|
+
"version": "0.3.19-alpha.6",
|
14
14
|
"author": "100ms",
|
15
15
|
"license": "MIT",
|
16
16
|
"repository": {
|
@@ -75,12 +75,12 @@
|
|
75
75
|
"react": ">=17.0.2 <19.0.0"
|
76
76
|
},
|
77
77
|
"dependencies": {
|
78
|
-
"@100mslive/hls-player": "0.3.19-alpha.
|
78
|
+
"@100mslive/hls-player": "0.3.19-alpha.6",
|
79
79
|
"@100mslive/hms-noise-cancellation": "0.0.1",
|
80
|
-
"@100mslive/hms-virtual-background": "1.13.19-alpha.
|
81
|
-
"@100mslive/hms-whiteboard": "0.0.9-alpha.
|
82
|
-
"@100mslive/react-icons": "0.10.19-alpha.
|
83
|
-
"@100mslive/react-sdk": "0.10.19-alpha.
|
80
|
+
"@100mslive/hms-virtual-background": "1.13.19-alpha.6",
|
81
|
+
"@100mslive/hms-whiteboard": "0.0.9-alpha.6",
|
82
|
+
"@100mslive/react-icons": "0.10.19-alpha.6",
|
83
|
+
"@100mslive/react-sdk": "0.10.19-alpha.6",
|
84
84
|
"@100mslive/types-prebuilt": "0.12.12",
|
85
85
|
"@emoji-mart/data": "^1.0.6",
|
86
86
|
"@emoji-mart/react": "^1.0.1",
|
@@ -117,5 +117,5 @@
|
|
117
117
|
"uuid": "^8.3.2",
|
118
118
|
"worker-timers": "^7.0.40"
|
119
119
|
},
|
120
|
-
"gitHead": "
|
120
|
+
"gitHead": "bff1ab1173426dcefe0c58e22ac406f01a110443"
|
121
121
|
}
|
@@ -1,5 +1,7 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
|
2
|
+
// Open issue with eslint-plugin-import https://github.com/import-js/eslint-plugin-import/issues/1810
|
3
|
+
// eslint-disable-next-line
|
4
|
+
import { HMSVirtualBackgroundTypes } from '@100mslive/hms-virtual-background/hmsvbplugin';
|
3
5
|
import { Box } from '../../../Layout';
|
4
6
|
import { Text } from '../../../Text';
|
5
7
|
import { VBOption } from './VBOption';
|
@@ -1,14 +1,24 @@
|
|
1
|
-
|
1
|
+
// Open issue with eslint-plugin-import https://github.com/import-js/eslint-plugin-import/issues/1810
|
2
|
+
// eslint-disable-next-line
|
3
|
+
import { HMSVBPlugin, HMSVirtualBackgroundTypes } from '@100mslive/hms-virtual-background/hmsvbplugin';
|
4
|
+
|
2
5
|
export class VBPlugin {
|
3
6
|
private hmsPlugin?: HMSVBPlugin;
|
4
|
-
private effectsPlugin?:
|
7
|
+
private effectsPlugin?: any;
|
5
8
|
|
6
|
-
initialisePlugin = (effectsSDKKey?: string, onInit?: () => void) => {
|
9
|
+
initialisePlugin = async (effectsSDKKey?: string, onInit?: () => void) => {
|
7
10
|
if (this.getVBObject()) {
|
8
11
|
return;
|
9
12
|
}
|
10
13
|
if (effectsSDKKey) {
|
11
|
-
|
14
|
+
try {
|
15
|
+
// eslint-disable-next-line
|
16
|
+
const { HMSEffectsPlugin } = await import('@100mslive/hms-virtual-background/hmseffectsplugin');
|
17
|
+
this.effectsPlugin = new HMSEffectsPlugin(effectsSDKKey, onInit);
|
18
|
+
} catch (error) {
|
19
|
+
console.error('Failed to initialise HMSEffectsPlugin:', error, 'Using HMSVBPlugin');
|
20
|
+
this.hmsPlugin = new HMSVBPlugin(HMSVirtualBackgroundTypes.NONE, HMSVirtualBackgroundTypes.NONE);
|
21
|
+
}
|
12
22
|
} else {
|
13
23
|
this.hmsPlugin = new HMSVBPlugin(HMSVirtualBackgroundTypes.NONE, HMSVirtualBackgroundTypes.NONE);
|
14
24
|
}
|
@@ -1,12 +1,15 @@
|
|
1
|
-
import React, { useEffect, useState } from 'react';
|
1
|
+
import React, { useEffect, useRef, useState } from 'react';
|
2
2
|
import { useMedia } from 'react-use';
|
3
3
|
import {
|
4
|
+
HMSMediaStreamPlugin,
|
4
5
|
selectAppData,
|
5
6
|
selectEffectsKey,
|
6
7
|
selectIsEffectsEnabled,
|
7
8
|
selectLocalPeerRole,
|
8
9
|
} from '@100mslive/hms-video-store';
|
9
|
-
|
10
|
+
// Open issue with eslint-plugin-import https://github.com/import-js/eslint-plugin-import/issues/1810
|
11
|
+
// eslint-disable-next-line
|
12
|
+
import { HMSVBPlugin, HMSVirtualBackgroundTypes } from '@100mslive/hms-virtual-background/hmsvbplugin';
|
10
13
|
import { VirtualBackgroundMedia } from '@100mslive/types-prebuilt/elements/virtual_background';
|
11
14
|
import {
|
12
15
|
HMSRoomState,
|
@@ -54,49 +57,61 @@ export const VBPicker = ({ backgroundMedia = [] }: { backgroundMedia: VirtualBac
|
|
54
57
|
const isPluginAdded = useHMSStore(selectIsLocalVideoPluginPresent(VBHandler?.getName() || ''));
|
55
58
|
const background = useHMSStore(selectAppData(APP_DATA.background));
|
56
59
|
const mediaList = backgroundMedia.map((media: VirtualBackgroundMedia) => media.url || '');
|
60
|
+
const pluginLoadingRef = useRef(false);
|
57
61
|
|
58
62
|
const inPreview = roomState === HMSRoomState.Preview;
|
59
63
|
// Hidden in preview as the effect will be visible in the preview tile
|
60
64
|
const showVideoTile = isVideoOn && isLargeRoom && !inPreview;
|
61
65
|
|
62
66
|
useEffect(() => {
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
VBHandler.initialisePlugin(isEffectsEnabled && effectsKey ? effectsKey : '', () => setLoadingEffects(false));
|
74
|
-
vbObject = VBHandler.getVBObject();
|
67
|
+
const initializeVirtualBackground = async () => {
|
68
|
+
if (!track?.id || pluginLoadingRef.current || isPluginAdded) {
|
69
|
+
return;
|
70
|
+
}
|
71
|
+
|
72
|
+
const isEffectsSupported = doesBrowserSupportEffectsSDK();
|
73
|
+
setIsBlurSupported(isEffectsSupported);
|
74
|
+
|
75
|
+
try {
|
76
|
+
pluginLoadingRef.current = true;
|
75
77
|
if (isEffectsEnabled && isEffectsSupported && effectsKey) {
|
76
|
-
|
78
|
+
setLoadingEffects(true);
|
79
|
+
await VBHandler.initialisePlugin(effectsKey, () => {
|
80
|
+
setLoadingEffects(false);
|
81
|
+
});
|
82
|
+
hmsActions.addPluginsToVideoStream([VBHandler.getVBObject() as HMSMediaStreamPlugin]);
|
77
83
|
} else {
|
78
84
|
setLoadingEffects(false);
|
79
85
|
if (!role) {
|
80
86
|
return;
|
81
87
|
}
|
82
|
-
|
88
|
+
await VBHandler.initialisePlugin();
|
89
|
+
await hmsActions.addPluginToVideoTrack(
|
90
|
+
VBHandler.getVBObject() as HMSVBPlugin,
|
91
|
+
Math.floor(role.publishParams.video.frameRate / 2),
|
92
|
+
);
|
83
93
|
}
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
94
|
+
|
95
|
+
const handleDefaultBackground = async () => {
|
96
|
+
switch (background) {
|
97
|
+
case HMSVirtualBackgroundTypes.NONE:
|
98
|
+
break;
|
99
|
+
case HMSVirtualBackgroundTypes.BLUR:
|
100
|
+
await VBHandler.setBlur(blurAmount);
|
101
|
+
break;
|
102
|
+
default:
|
103
|
+
await VBHandler.setBackground(background);
|
93
104
|
}
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
}
|
98
|
-
|
99
|
-
|
105
|
+
};
|
106
|
+
|
107
|
+
await handleDefaultBackground();
|
108
|
+
} catch (error) {
|
109
|
+
console.error('Error initializing virtual background:', error);
|
110
|
+
setLoadingEffects(false);
|
111
|
+
}
|
112
|
+
};
|
113
|
+
|
114
|
+
initializeVirtualBackground();
|
100
115
|
}, [
|
101
116
|
hmsActions,
|
102
117
|
role,
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import React, { useEffect } from 'react';
|
2
|
-
|
2
|
+
// eslint-disable-next-line
|
3
|
+
import { HMSVirtualBackgroundTypes } from '@100mslive/hms-virtual-background/hmsvbplugin';
|
3
4
|
import {
|
4
5
|
selectAppData,
|
5
6
|
selectIsEffectsEnabled,
|
File without changes
|