@100mslive/roomkit-react 0.3.19-alpha.8 → 0.3.19
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/{HLSView-72N5Y4QP.js → HLSView-GYB2QDIN.js} +2 -2
- package/dist/{HLSView-Y4ED3H3Z.css → HLSView-LNJLFWK4.css} +3 -3
- package/dist/{HLSView-Y4ED3H3Z.css.map → HLSView-LNJLFWK4.css.map} +1 -1
- package/dist/Prebuilt/components/VirtualBackground/VBHandler.d.ts +1 -0
- package/dist/{chunk-P323KKZF.js → chunk-DIIFM6TW.js} +145 -127
- package/dist/chunk-DIIFM6TW.js.map +7 -0
- package/dist/index.cjs.css +2 -2
- package/dist/index.cjs.css.map +1 -1
- package/dist/index.cjs.js +574 -563
- 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 +46 -65
- package/dist/meta.esbuild.json +58 -77
- package/package.json +7 -7
- package/src/Prebuilt/AppStateContext.tsx +8 -5
- package/src/Prebuilt/common/PeersSorter.ts +2 -1
- package/src/Prebuilt/components/EndCallFeedback/Feedback.tsx +3 -2
- package/src/Prebuilt/components/EndCallFeedback/FeedbackForm.tsx +16 -6
- package/src/Prebuilt/components/EndCallFeedback/ThankyouView.tsx +1 -1
- package/src/Prebuilt/components/InsetTile.tsx +1 -1
- package/src/Prebuilt/components/Leave/LeaveSessionContent.tsx +3 -1
- package/src/Prebuilt/components/PIP/PIPChat.tsx +11 -4
- package/src/Prebuilt/components/VirtualBackground/VBHandler.tsx +15 -3
- package/src/Prebuilt/components/VirtualBackground/VBPicker.tsx +21 -16
- package/src/Prebuilt/plugins/CaptionsViewer.tsx +4 -1
- package/dist/Prebuilt/components/VirtualBackground/util.d.ts +0 -1
- package/dist/chunk-P323KKZF.js.map +0 -7
- package/src/Prebuilt/components/VirtualBackground/util.tsx +0 -13
- /package/dist/{HLSView-72N5Y4QP.js.map → HLSView-GYB2QDIN.js.map} +0 -0
@@ -1,7 +1,8 @@
|
|
1
1
|
// Open issue with eslint-plugin-import https://github.com/import-js/eslint-plugin-import/issues/1810
|
2
2
|
// eslint-disable-next-line
|
3
3
|
import { HMSVBPlugin, HMSVirtualBackgroundTypes } from '@100mslive/hms-virtual-background/hmsvbplugin';
|
4
|
-
|
4
|
+
import { parsedUserAgent } from '@100mslive/react-sdk';
|
5
|
+
import { isSafari } from '../../common/constants';
|
5
6
|
export class VBPlugin {
|
6
7
|
private hmsPlugin?: HMSVBPlugin;
|
7
8
|
private effectsPlugin?: any;
|
@@ -13,8 +14,8 @@ export class VBPlugin {
|
|
13
14
|
if (effectsSDKKey) {
|
14
15
|
try {
|
15
16
|
// eslint-disable-next-line
|
16
|
-
const
|
17
|
-
this.effectsPlugin = new HMSEffectsPlugin(effectsSDKKey, onInit);
|
17
|
+
const effects = await import('@100mslive/hms-virtual-background/hmseffectsplugin');
|
18
|
+
this.effectsPlugin = new effects.HMSEffectsPlugin(effectsSDKKey, onInit);
|
18
19
|
} catch (error) {
|
19
20
|
console.error('Failed to initialise HMSEffectsPlugin:', error, 'Using HMSVBPlugin');
|
20
21
|
this.hmsPlugin = new HMSVBPlugin(HMSVirtualBackgroundTypes.NONE, HMSVirtualBackgroundTypes.NONE);
|
@@ -101,6 +102,17 @@ export class VBPlugin {
|
|
101
102
|
this.effectsPlugin = undefined;
|
102
103
|
this.hmsPlugin = undefined;
|
103
104
|
};
|
105
|
+
|
106
|
+
isEffectsSupported = () => {
|
107
|
+
if (!isSafari) {
|
108
|
+
return true;
|
109
|
+
}
|
110
|
+
const browserVersion = parsedUserAgent?.getBrowser()?.version || '16';
|
111
|
+
if (browserVersion && parseInt(browserVersion.split('.')[0]) < 17) {
|
112
|
+
return false;
|
113
|
+
}
|
114
|
+
return true;
|
115
|
+
};
|
104
116
|
}
|
105
117
|
|
106
118
|
export const VBHandler = new VBPlugin();
|
@@ -25,7 +25,6 @@ import {
|
|
25
25
|
import { BlurPersonHighIcon, CrossCircleIcon, CrossIcon } from '@100mslive/react-icons';
|
26
26
|
import { Box, config as cssConfig, Flex, Loading, Slider, Video } from '../../../index';
|
27
27
|
import { Text } from '../../../Text';
|
28
|
-
import { doesBrowserSupportEffectsSDK } from './util';
|
29
28
|
import { VBCollection } from './VBCollection';
|
30
29
|
import { VBHandler } from './VBHandler';
|
31
30
|
// @ts-ignore
|
@@ -49,7 +48,7 @@ export const VBPicker = ({ backgroundMedia = [] }: { backgroundMedia: VirtualBac
|
|
49
48
|
const [blurAmount, setBlurAmount] = useState(VBHandler.getBlurAmount() || 0.5);
|
50
49
|
const roomState = useHMSStore(selectRoomState);
|
51
50
|
const isLargeRoom = useHMSStore(selectIsLargeRoom);
|
52
|
-
const
|
51
|
+
const isEffectsSupported = VBHandler.isEffectsSupported();
|
53
52
|
const isEffectsEnabled = useHMSStore(selectIsEffectsEnabled);
|
54
53
|
const effectsKey = useHMSStore(selectEffectsKey);
|
55
54
|
const isMobile = useMedia(cssConfig.media.md);
|
@@ -64,14 +63,22 @@ export const VBPicker = ({ backgroundMedia = [] }: { backgroundMedia: VirtualBac
|
|
64
63
|
const showVideoTile = isVideoOn && isLargeRoom && !inPreview;
|
65
64
|
|
66
65
|
useEffect(() => {
|
66
|
+
const addHMSVBPlugin = async () => {
|
67
|
+
setLoadingEffects(false);
|
68
|
+
if (!role) {
|
69
|
+
return;
|
70
|
+
}
|
71
|
+
await VBHandler.initialisePlugin();
|
72
|
+
await hmsActions.addPluginToVideoTrack(
|
73
|
+
VBHandler.getVBObject() as HMSVBPlugin,
|
74
|
+
Math.floor(role.publishParams.video.frameRate / 2),
|
75
|
+
);
|
76
|
+
};
|
67
77
|
const initializeVirtualBackground = async () => {
|
68
78
|
if (!track?.id || pluginLoadingRef.current || isPluginAdded) {
|
69
79
|
return;
|
70
80
|
}
|
71
81
|
|
72
|
-
const isEffectsSupported = doesBrowserSupportEffectsSDK();
|
73
|
-
setIsBlurSupported(isEffectsSupported);
|
74
|
-
|
75
82
|
try {
|
76
83
|
pluginLoadingRef.current = true;
|
77
84
|
if (isEffectsEnabled && isEffectsSupported && effectsKey) {
|
@@ -79,17 +86,14 @@ export const VBPicker = ({ backgroundMedia = [] }: { backgroundMedia: VirtualBac
|
|
79
86
|
await VBHandler.initialisePlugin(effectsKey, () => {
|
80
87
|
setLoadingEffects(false);
|
81
88
|
});
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
89
|
+
const vbInstance = VBHandler.getVBObject();
|
90
|
+
if (vbInstance.getName() === 'HMSEffects') {
|
91
|
+
hmsActions.addPluginsToVideoStream([VBHandler.getVBObject() as HMSMediaStreamPlugin]);
|
92
|
+
} else {
|
93
|
+
await addHMSVBPlugin();
|
87
94
|
}
|
88
|
-
|
89
|
-
await
|
90
|
-
VBHandler.getVBObject() as HMSVBPlugin,
|
91
|
-
Math.floor(role.publishParams.video.frameRate / 2),
|
92
|
-
);
|
95
|
+
} else {
|
96
|
+
await addHMSVBPlugin();
|
93
97
|
}
|
94
98
|
|
95
99
|
const handleDefaultBackground = async () => {
|
@@ -117,6 +121,7 @@ export const VBPicker = ({ backgroundMedia = [] }: { backgroundMedia: VirtualBac
|
|
117
121
|
role,
|
118
122
|
isPluginAdded,
|
119
123
|
isEffectsEnabled,
|
124
|
+
isEffectsSupported,
|
120
125
|
effectsKey,
|
121
126
|
track?.id,
|
122
127
|
background,
|
@@ -185,7 +190,7 @@ export const VBPicker = ({ backgroundMedia = [] }: { backgroundMedia: VirtualBac
|
|
185
190
|
await VBHandler?.setBlur(blurAmount);
|
186
191
|
hmsActions.setAppData(APP_DATA.background, HMSVirtualBackgroundTypes.BLUR);
|
187
192
|
},
|
188
|
-
supported:
|
193
|
+
supported: isEffectsSupported && isEffectsEnabled,
|
189
194
|
},
|
190
195
|
]}
|
191
196
|
activeBackground={background}
|
@@ -144,7 +144,10 @@ class Queue {
|
|
144
144
|
}
|
145
145
|
|
146
146
|
class CaptionMaintainerQueue {
|
147
|
-
captionData: Queue
|
147
|
+
captionData: Queue;
|
148
|
+
constructor() {
|
149
|
+
this.captionData = new Queue();
|
150
|
+
}
|
148
151
|
push(data: HMSTranscript[] = []) {
|
149
152
|
data.forEach((value: HMSTranscript) => {
|
150
153
|
this.captionData.enqueue(value);
|
@@ -1 +0,0 @@
|
|
1
|
-
export declare const doesBrowserSupportEffectsSDK: () => boolean;
|