@100mslive/roomkit-react 0.3.19-alpha.9 → 0.3.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/dist/{HLSView-EYFJ7YDU.js → HLSView-GYB2QDIN.js} +2 -2
  2. package/dist/{HLSView-5SR3RWXG.css → HLSView-LNJLFWK4.css} +3 -3
  3. package/dist/{HLSView-5SR3RWXG.css.map → HLSView-LNJLFWK4.css.map} +1 -1
  4. package/dist/Prebuilt/components/VirtualBackground/VBHandler.d.ts +1 -0
  5. package/dist/{chunk-3FZB2LJY.js → chunk-DIIFM6TW.js} +144 -126
  6. package/dist/chunk-DIIFM6TW.js.map +7 -0
  7. package/dist/index.cjs.css +2 -2
  8. package/dist/index.cjs.css.map +1 -1
  9. package/dist/index.cjs.js +573 -562
  10. package/dist/index.cjs.js.map +4 -4
  11. package/dist/index.css +2 -2
  12. package/dist/index.css.map +1 -1
  13. package/dist/index.js +1 -1
  14. package/dist/meta.cjs.json +44 -63
  15. package/dist/meta.esbuild.json +56 -75
  16. package/package.json +7 -7
  17. package/src/Prebuilt/AppStateContext.tsx +8 -5
  18. package/src/Prebuilt/components/EndCallFeedback/Feedback.tsx +3 -2
  19. package/src/Prebuilt/components/EndCallFeedback/FeedbackForm.tsx +16 -6
  20. package/src/Prebuilt/components/EndCallFeedback/ThankyouView.tsx +1 -1
  21. package/src/Prebuilt/components/InsetTile.tsx +1 -1
  22. package/src/Prebuilt/components/Leave/LeaveSessionContent.tsx +3 -1
  23. package/src/Prebuilt/components/PIP/PIPChat.tsx +11 -4
  24. package/src/Prebuilt/components/VirtualBackground/VBHandler.tsx +15 -3
  25. package/src/Prebuilt/components/VirtualBackground/VBPicker.tsx +21 -16
  26. package/dist/Prebuilt/components/VirtualBackground/util.d.ts +0 -1
  27. package/dist/chunk-3FZB2LJY.js.map +0 -7
  28. package/src/Prebuilt/components/VirtualBackground/util.tsx +0 -13
  29. /package/dist/{HLSView-EYFJ7YDU.js.map → HLSView-GYB2QDIN.js.map} +0 -0
@@ -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 [isBlurSupported, setIsBlurSupported] = useState(false);
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
- hmsActions.addPluginsToVideoStream([VBHandler.getVBObject() as HMSMediaStreamPlugin]);
83
- } else {
84
- setLoadingEffects(false);
85
- if (!role) {
86
- return;
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
- await VBHandler.initialisePlugin();
89
- await hmsActions.addPluginToVideoTrack(
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: isBlurSupported,
193
+ supported: isEffectsSupported && isEffectsEnabled,
189
194
  },
190
195
  ]}
191
196
  activeBackground={background}
@@ -1 +0,0 @@
1
- export declare const doesBrowserSupportEffectsSDK: () => boolean;