@100mslive/roomkit-react 0.1.19-alpha.1 → 0.1.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.
- package/dist/{HLSView-UBVLOPNY.js → HLSView-4L4OAX2K.js} +2 -2
- package/dist/Prebuilt/App.d.ts +1 -0
- package/dist/Prebuilt/common/constants.d.ts +1 -1
- package/dist/Prebuilt/components/Chat/EmptyChat.d.ts +2 -0
- package/dist/Prebuilt/components/Polls/Voting/{Leaderboard.d.ts → LeaderboardSummary.d.ts} +1 -1
- package/dist/Prebuilt/components/Polls/Voting/StatisticBox.d.ts +5 -0
- package/dist/Prebuilt/components/VirtualBackground/VBCollection.d.ts +3 -4
- package/dist/Prebuilt/components/VirtualBackground/VBHandler.d.ts +14 -0
- package/dist/Prebuilt/components/VirtualBackground/VBPicker.d.ts +1 -1
- package/dist/Prebuilt/components/VirtualBackground/constants.d.ts +0 -2
- package/dist/{chunk-VU2CQFCB.js → chunk-NHPPOGUF.js} +1403 -1293
- package/dist/chunk-NHPPOGUF.js.map +7 -0
- package/dist/index.cjs.js +1749 -1609
- package/dist/index.cjs.js.map +4 -4
- package/dist/index.js +1 -1
- package/dist/meta.cjs.json +236 -94
- package/dist/meta.esbuild.json +243 -101
- package/package.json +6 -6
- package/src/Prebuilt/App.tsx +2 -1
- package/src/Prebuilt/AppStateContext.tsx +2 -0
- package/src/Prebuilt/common/constants.ts +1 -1
- package/src/Prebuilt/components/Chat/Chat.tsx +2 -2
- package/src/Prebuilt/components/Chat/ChatActions.tsx +3 -3
- package/src/Prebuilt/components/Chat/ChatBody.tsx +28 -46
- package/src/Prebuilt/components/Chat/EmptyChat.tsx +51 -0
- package/src/Prebuilt/components/Footer/PaginatedParticipants.tsx +1 -1
- package/src/Prebuilt/components/Footer/PollsToggle.tsx +7 -1
- package/src/Prebuilt/components/Notifications/Notifications.tsx +0 -29
- package/src/Prebuilt/components/Polls/Polls.tsx +2 -2
- package/src/Prebuilt/components/Polls/Voting/LeaderboardEntry.tsx +2 -2
- package/src/Prebuilt/components/Polls/Voting/LeaderboardSummary.tsx +162 -0
- package/src/Prebuilt/components/Polls/Voting/PeerParticipationSummary.tsx +2 -9
- package/src/Prebuilt/components/Polls/Voting/StatisticBox.tsx +15 -0
- package/src/Prebuilt/components/Polls/Voting/Voting.jsx +1 -17
- package/src/Prebuilt/components/TileMenu/TileMenuContent.tsx +1 -1
- package/src/Prebuilt/components/VirtualBackground/VBCollection.tsx +5 -11
- package/src/Prebuilt/components/VirtualBackground/VBHandler.tsx +77 -0
- package/src/Prebuilt/components/VirtualBackground/VBPicker.tsx +45 -79
- package/src/Prebuilt/components/VirtualBackground/constants.ts +0 -4
- package/src/Prebuilt/layouts/SidePane.tsx +6 -1
- package/src/Theme/stitches.config.ts +2 -10
- package/dist/chunk-VU2CQFCB.js.map +0 -7
- package/src/Prebuilt/components/Polls/Voting/Leaderboard.tsx +0 -123
- package/src/Prebuilt/components/Polls/Voting/PollResultSummary.jsx +0 -125
- /package/dist/{HLSView-UBVLOPNY.js.map → HLSView-4L4OAX2K.js.map} +0 -0
| @@ -7,7 +7,6 @@ import { VBOption } from './VBOption'; | |
| 7 7 | 
             
            export const VBCollection = ({
         | 
| 8 8 | 
             
              options,
         | 
| 9 9 | 
             
              title,
         | 
| 10 | 
            -
              activeBackgroundType = HMSVirtualBackgroundTypes.NONE,
         | 
| 11 10 | 
             
              activeBackground = '',
         | 
| 12 11 | 
             
            }: {
         | 
| 13 12 | 
             
              options: {
         | 
| @@ -15,11 +14,10 @@ export const VBCollection = ({ | |
| 15 14 | 
             
                icon?: React.JSX.Element;
         | 
| 16 15 | 
             
                onClick?: () => Promise<void>;
         | 
| 17 16 | 
             
                mediaURL?: string;
         | 
| 18 | 
            -
                 | 
| 17 | 
            +
                value: string | HMSVirtualBackgroundTypes;
         | 
| 19 18 | 
             
              }[];
         | 
| 20 19 | 
             
              title: string;
         | 
| 21 | 
            -
              activeBackground:  | 
| 22 | 
            -
              activeBackgroundType: HMSVirtualBackgroundTypes;
         | 
| 20 | 
            +
              activeBackground: string;
         | 
| 23 21 | 
             
            }) => {
         | 
| 24 22 | 
             
              if (options.length === 0) {
         | 
| 25 23 | 
             
                return null;
         | 
| @@ -32,14 +30,10 @@ export const VBCollection = ({ | |
| 32 30 | 
             
                  <Box css={{ py: '$4', display: 'grid', gridTemplateColumns: '1fr 1fr 1fr', gap: '$8' }}>
         | 
| 33 31 | 
             
                    {options.map((option, index) => (
         | 
| 34 32 | 
             
                      <VBOption.Root
         | 
| 35 | 
            -
                         | 
| 36 | 
            -
                         | 
| 33 | 
            +
                        key={option.value}
         | 
| 34 | 
            +
                        testid={option.value === HMSVirtualBackgroundTypes.IMAGE ? `virtual_bg_option-${index}` : option.value}
         | 
| 37 35 | 
             
                        {...option}
         | 
| 38 | 
            -
                        isActive={
         | 
| 39 | 
            -
                          ([HMSVirtualBackgroundTypes.NONE, HMSVirtualBackgroundTypes.BLUR].includes(activeBackgroundType) &&
         | 
| 40 | 
            -
                            option.type === activeBackgroundType) ||
         | 
| 41 | 
            -
                          activeBackground === option?.mediaURL
         | 
| 42 | 
            -
                        }
         | 
| 36 | 
            +
                        isActive={activeBackground === option.value}
         | 
| 43 37 | 
             
                      >
         | 
| 44 38 | 
             
                        <VBOption.Icon>{option?.icon}</VBOption.Icon>
         | 
| 45 39 | 
             
                        <VBOption.Title>{option?.title}</VBOption.Title>
         | 
| @@ -0,0 +1,77 @@ | |
| 1 | 
            +
            import { HMSEffectsPlugin, HMSVBPlugin, HMSVirtualBackgroundTypes } from '@100mslive/hms-virtual-background';
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            export class VBPlugin {
         | 
| 4 | 
            +
              private hmsPlugin?: HMSVBPlugin;
         | 
| 5 | 
            +
              private effectsPlugin?: HMSEffectsPlugin | undefined;
         | 
| 6 | 
            +
             | 
| 7 | 
            +
              initialisePlugin = (effectsSDKKey?: string) => {
         | 
| 8 | 
            +
                if (this.getVBObject()) {
         | 
| 9 | 
            +
                  return;
         | 
| 10 | 
            +
                }
         | 
| 11 | 
            +
                if (effectsSDKKey) {
         | 
| 12 | 
            +
                  this.effectsPlugin = new HMSEffectsPlugin(effectsSDKKey);
         | 
| 13 | 
            +
                } else {
         | 
| 14 | 
            +
                  this.hmsPlugin = new HMSVBPlugin(HMSVirtualBackgroundTypes.NONE, HMSVirtualBackgroundTypes.NONE);
         | 
| 15 | 
            +
                }
         | 
| 16 | 
            +
              };
         | 
| 17 | 
            +
             | 
| 18 | 
            +
              getBackground = () => {
         | 
| 19 | 
            +
                if (this.effectsPlugin) {
         | 
| 20 | 
            +
                  return this.effectsPlugin?.getBackground();
         | 
| 21 | 
            +
                } else {
         | 
| 22 | 
            +
                  // @ts-ignore
         | 
| 23 | 
            +
                  return this.hmsPlugin?.background?.src || this.hmsPlugin?.background;
         | 
| 24 | 
            +
                }
         | 
| 25 | 
            +
              };
         | 
| 26 | 
            +
             | 
| 27 | 
            +
              getVBObject = () => {
         | 
| 28 | 
            +
                return this.effectsPlugin || this.hmsPlugin;
         | 
| 29 | 
            +
              };
         | 
| 30 | 
            +
             | 
| 31 | 
            +
              getName = () => {
         | 
| 32 | 
            +
                return this.effectsPlugin ? this.effectsPlugin?.getName() : this.hmsPlugin?.getName();
         | 
| 33 | 
            +
              };
         | 
| 34 | 
            +
             | 
| 35 | 
            +
              setBlur = async (blurPower: number) => {
         | 
| 36 | 
            +
                if (this.effectsPlugin) {
         | 
| 37 | 
            +
                  this.effectsPlugin?.setBlur(blurPower);
         | 
| 38 | 
            +
                } else {
         | 
| 39 | 
            +
                  await this.hmsPlugin?.setBackground(HMSVirtualBackgroundTypes.BLUR, HMSVirtualBackgroundTypes.BLUR);
         | 
| 40 | 
            +
                }
         | 
| 41 | 
            +
              };
         | 
| 42 | 
            +
             | 
| 43 | 
            +
              setBackground = async (mediaURL: string) => {
         | 
| 44 | 
            +
                if (this.effectsPlugin) {
         | 
| 45 | 
            +
                  this.effectsPlugin?.setBackground(mediaURL);
         | 
| 46 | 
            +
                } else {
         | 
| 47 | 
            +
                  const img = document.createElement('img');
         | 
| 48 | 
            +
                  let retries = 0;
         | 
| 49 | 
            +
                  const MAX_RETRIES = 3;
         | 
| 50 | 
            +
                  img.alt = 'VB';
         | 
| 51 | 
            +
                  img.src = mediaURL;
         | 
| 52 | 
            +
                  try {
         | 
| 53 | 
            +
                    await this.hmsPlugin?.setBackground(img, HMSVirtualBackgroundTypes.IMAGE);
         | 
| 54 | 
            +
                  } catch (e) {
         | 
| 55 | 
            +
                    console.error(e);
         | 
| 56 | 
            +
                    if (retries++ < MAX_RETRIES) {
         | 
| 57 | 
            +
                      await this.hmsPlugin?.setBackground(img, HMSVirtualBackgroundTypes.IMAGE);
         | 
| 58 | 
            +
                    }
         | 
| 59 | 
            +
                  }
         | 
| 60 | 
            +
                }
         | 
| 61 | 
            +
              };
         | 
| 62 | 
            +
             | 
| 63 | 
            +
              removeEffects = async () => {
         | 
| 64 | 
            +
                if (this.effectsPlugin) {
         | 
| 65 | 
            +
                  this.effectsPlugin?.removeEffects();
         | 
| 66 | 
            +
                } else {
         | 
| 67 | 
            +
                  await this.hmsPlugin?.setBackground(HMSVirtualBackgroundTypes.NONE, HMSVirtualBackgroundTypes.NONE);
         | 
| 68 | 
            +
                }
         | 
| 69 | 
            +
              };
         | 
| 70 | 
            +
             | 
| 71 | 
            +
              reset = () => {
         | 
| 72 | 
            +
                this.effectsPlugin = undefined;
         | 
| 73 | 
            +
                this.hmsPlugin = undefined;
         | 
| 74 | 
            +
              };
         | 
| 75 | 
            +
            }
         | 
| 76 | 
            +
             | 
| 77 | 
            +
            export const VBHandler = new VBPlugin();
         | 
| @@ -1,13 +1,13 @@ | |
| 1 | 
            -
            import React, { useEffect,  | 
| 2 | 
            -
            import {  | 
| 1 | 
            +
            import React, { useEffect, useState } from 'react';
         | 
| 2 | 
            +
            import { selectEffectsKey, selectIsEffectsEnabled, selectLocalPeerRole } from '@100mslive/hms-video-store';
         | 
| 3 | 
            +
            import { HMSEffectsPlugin, HMSVBPlugin, HMSVirtualBackgroundTypes } from '@100mslive/hms-virtual-background';
         | 
| 3 4 | 
             
            import { VirtualBackgroundMedia } from '@100mslive/types-prebuilt/elements/virtual_background';
         | 
| 4 5 | 
             
            import {
         | 
| 5 6 | 
             
              HMSRoomState,
         | 
| 6 7 | 
             
              selectIsLargeRoom,
         | 
| 7 8 | 
             
              selectIsLocalVideoEnabled,
         | 
| 9 | 
            +
              selectIsLocalVideoPluginPresent,
         | 
| 8 10 | 
             
              selectLocalPeer,
         | 
| 9 | 
            -
              selectLocalPeerRole,
         | 
| 10 | 
            -
              selectLocalVideoTrackID,
         | 
| 11 11 | 
             
              selectRoomState,
         | 
| 12 12 | 
             
              selectVideoTrackByID,
         | 
| 13 13 | 
             
              useHMSActions,
         | 
| @@ -17,96 +17,61 @@ import { BlurPersonHighIcon, CloseIcon, CrossCircleIcon } from '@100mslive/react | |
| 17 17 | 
             
            import { Box, Flex, Video } from '../../../index';
         | 
| 18 18 | 
             
            import { Text } from '../../../Text';
         | 
| 19 19 | 
             
            import { VBCollection } from './VBCollection';
         | 
| 20 | 
            +
            import { VBHandler } from './VBHandler';
         | 
| 20 21 | 
             
            // @ts-ignore
         | 
| 21 22 | 
             
            import { useSidepaneToggle } from '../AppData/useSidepane';
         | 
| 22 23 | 
             
            // @ts-ignore
         | 
| 23 24 | 
             
            import { useUISettings } from '../AppData/useUISettings';
         | 
| 24 | 
            -
            // @ts-ignore
         | 
| 25 25 | 
             
            import { SIDE_PANE_OPTIONS, UI_SETTINGS } from '../../common/constants';
         | 
| 26 | 
            -
            import { defaultMedia | 
| 26 | 
            +
            import { defaultMedia } from './constants';
         | 
| 27 27 |  | 
| 28 28 | 
             
            const iconDims = { height: '40px', width: '40px' };
         | 
| 29 | 
            -
            const MAX_RETRIES = 2;
         | 
| 30 29 |  | 
| 31 30 | 
             
            export const VBPicker = ({ backgroundMedia = [] }: { backgroundMedia: VirtualBackgroundMedia[] }) => {
         | 
| 32 31 | 
             
              const toggleVB = useSidepaneToggle(SIDE_PANE_OPTIONS.VB);
         | 
| 33 32 | 
             
              const hmsActions = useHMSActions();
         | 
| 34 | 
            -
              const role = useHMSStore(selectLocalPeerRole);
         | 
| 35 | 
            -
              const [isVBSupported, setIsVBSupported] = useState(false);
         | 
| 36 | 
            -
              const localPeerVideoTrackID = useHMSStore(selectLocalVideoTrackID);
         | 
| 37 33 | 
             
              const localPeer = useHMSStore(selectLocalPeer);
         | 
| 38 | 
            -
               | 
| 39 | 
            -
              const [background, setBackground] = useState(vbPlugin.background);
         | 
| 40 | 
            -
              // @ts-ignore
         | 
| 41 | 
            -
              const [backgroundType, setBackgroundType] = useState(vbPlugin.backgroundType);
         | 
| 34 | 
            +
              const role = useHMSStore(selectLocalPeerRole);
         | 
| 42 35 | 
             
              const isVideoOn = useHMSStore(selectIsLocalVideoEnabled);
         | 
| 43 36 | 
             
              const mirrorLocalVideo = useUISettings(UI_SETTINGS.mirrorLocalVideo);
         | 
| 44 37 | 
             
              const trackSelector = selectVideoTrackByID(localPeer?.videoTrack);
         | 
| 45 38 | 
             
              const track = useHMSStore(trackSelector);
         | 
| 46 39 | 
             
              const roomState = useHMSStore(selectRoomState);
         | 
| 47 40 | 
             
              const isLargeRoom = useHMSStore(selectIsLargeRoom);
         | 
| 48 | 
            -
              const  | 
| 41 | 
            +
              const isEffectsEnabled = useHMSStore(selectIsEffectsEnabled);
         | 
| 42 | 
            +
              const effectsKey = useHMSStore(selectEffectsKey);
         | 
| 43 | 
            +
              const isPluginAdded = useHMSStore(selectIsLocalVideoPluginPresent(VBHandler?.getName() || ''));
         | 
| 44 | 
            +
              const [activeBackground, setActiveBackground] = useState<string | HMSVirtualBackgroundTypes>(
         | 
| 45 | 
            +
                (VBHandler?.getBackground() as string | HMSVirtualBackgroundTypes) || HMSVirtualBackgroundTypes.NONE,
         | 
| 46 | 
            +
              );
         | 
| 49 47 | 
             
              const mediaList = backgroundMedia.length
         | 
| 50 | 
            -
                ? backgroundMedia.map((media: VirtualBackgroundMedia) => media | 
| 48 | 
            +
                ? backgroundMedia.map((media: VirtualBackgroundMedia) => media.url || '')
         | 
| 51 49 | 
             
                : defaultMedia;
         | 
| 52 50 |  | 
| 53 51 | 
             
              const inPreview = roomState === HMSRoomState.Preview;
         | 
| 54 | 
            -
              // Hidden in preview as the effect will be visible in the preview tile | 
| 52 | 
            +
              // Hidden in preview as the effect will be visible in the preview tile
         | 
| 55 53 | 
             
              const showVideoTile = isVideoOn && isLargeRoom && !inPreview;
         | 
| 56 54 |  | 
| 57 | 
            -
              const clearVBState = () => {
         | 
| 58 | 
            -
                setBackground(HMSVirtualBackgroundTypes.NONE);
         | 
| 59 | 
            -
                setBackgroundType(HMSVirtualBackgroundTypes.NONE);
         | 
| 60 | 
            -
              };
         | 
| 61 | 
            -
             | 
| 62 55 | 
             
              useEffect(() => {
         | 
| 63 | 
            -
                if (! | 
| 56 | 
            +
                if (!track?.id) {
         | 
| 64 57 | 
             
                  return;
         | 
| 65 58 | 
             
                }
         | 
| 66 | 
            -
             | 
| 67 | 
            -
             | 
| 68 | 
            -
             | 
| 69 | 
            -
             | 
| 70 | 
            -
             | 
| 71 | 
            -
             | 
| 72 | 
            -
             | 
| 73 | 
            -
             | 
| 74 | 
            -
             | 
| 75 | 
            -
             | 
| 76 | 
            -
                  vbPlugin.setBackground(HMSVirtualBackgroundTypes.NONE, HMSVirtualBackgroundTypes.NONE);
         | 
| 77 | 
            -
                  clearVBState();
         | 
| 78 | 
            -
                }
         | 
| 79 | 
            -
              }
         | 
| 80 | 
            -
             | 
| 81 | 
            -
              async function addPlugin({ mediaURL = '', blurPower = 0 }) {
         | 
| 82 | 
            -
                let retries = 0;
         | 
| 83 | 
            -
                try {
         | 
| 84 | 
            -
                  if (mediaURL) {
         | 
| 85 | 
            -
                    const img = document.createElement('img');
         | 
| 86 | 
            -
                    img.alt = 'VB';
         | 
| 87 | 
            -
                    img.src = mediaURL;
         | 
| 88 | 
            -
                    try {
         | 
| 89 | 
            -
                      await vbPlugin.setBackground(img, HMSVirtualBackgroundTypes.IMAGE);
         | 
| 90 | 
            -
                    } catch (e) {
         | 
| 91 | 
            -
                      console.error(e);
         | 
| 92 | 
            -
                      if (retries++ < MAX_RETRIES) {
         | 
| 93 | 
            -
                        await vbPlugin.setBackground(img, HMSVirtualBackgroundTypes.IMAGE);
         | 
| 59 | 
            +
                if (!isPluginAdded) {
         | 
| 60 | 
            +
                  let vbObject = VBHandler.getVBObject();
         | 
| 61 | 
            +
                  if (!vbObject) {
         | 
| 62 | 
            +
                    VBHandler.initialisePlugin(isEffectsEnabled && effectsKey ? effectsKey : '');
         | 
| 63 | 
            +
                    vbObject = VBHandler.getVBObject();
         | 
| 64 | 
            +
                    if (isEffectsEnabled && effectsKey) {
         | 
| 65 | 
            +
                      hmsActions.addPluginsToVideoStream([vbObject as HMSEffectsPlugin]);
         | 
| 66 | 
            +
                    } else {
         | 
| 67 | 
            +
                      if (!role) {
         | 
| 68 | 
            +
                        return;
         | 
| 94 69 | 
             
                      }
         | 
| 70 | 
            +
                      hmsActions.addPluginToVideoTrack(vbObject as HMSVBPlugin, Math.floor(role.publishParams.video.frameRate / 2));
         | 
| 95 71 | 
             
                    }
         | 
| 96 | 
            -
                  } else if (blurPower) {
         | 
| 97 | 
            -
                    await vbPlugin.setBackground(HMSVirtualBackgroundTypes.BLUR, HMSVirtualBackgroundTypes.BLUR);
         | 
| 98 | 
            -
                  }
         | 
| 99 | 
            -
                  setBackground(mediaURL || HMSVirtualBackgroundTypes.BLUR);
         | 
| 100 | 
            -
                  setBackgroundType(mediaURL ? HMSVirtualBackgroundTypes.IMAGE : HMSVirtualBackgroundTypes.BLUR);
         | 
| 101 | 
            -
                  if (role && !addedPluginToVideoTrack.current) {
         | 
| 102 | 
            -
                    await hmsActions.addPluginToVideoTrack(vbPlugin, Math.floor(role.publishParams.video.frameRate / 2));
         | 
| 103 | 
            -
                    addedPluginToVideoTrack.current = true;
         | 
| 104 72 | 
             
                  }
         | 
| 105 | 
            -
                } catch (err) {
         | 
| 106 | 
            -
                  console.error('Failed to apply VB', err);
         | 
| 107 | 
            -
                  disableEffects();
         | 
| 108 73 | 
             
                }
         | 
| 109 | 
            -
              }
         | 
| 74 | 
            +
              }, [hmsActions, role, isPluginAdded, isEffectsEnabled, effectsKey, track?.id]);
         | 
| 110 75 |  | 
| 111 76 | 
             
              useEffect(() => {
         | 
| 112 77 | 
             
                if (!isVideoOn) {
         | 
| @@ -114,10 +79,6 @@ export const VBPicker = ({ backgroundMedia = [] }: { backgroundMedia: VirtualBac | |
| 114 79 | 
             
                }
         | 
| 115 80 | 
             
              }, [isVideoOn, toggleVB]);
         | 
| 116 81 |  | 
| 117 | 
            -
              if (!isVBSupported) {
         | 
| 118 | 
            -
                return null;
         | 
| 119 | 
            -
              }
         | 
| 120 | 
            -
             | 
| 121 82 | 
             
              return (
         | 
| 122 83 | 
             
                <Flex css={{ pr: '$6', size: '100%' }} direction="column">
         | 
| 123 84 | 
             
                  <Flex align="center" justify="between" css={{ w: '100%', background: '$surface_dim', pb: '$4' }}>
         | 
| @@ -140,7 +101,6 @@ export const VBPicker = ({ backgroundMedia = [] }: { backgroundMedia: VirtualBac | |
| 140 101 | 
             
                      css={{ width: '100%', height: '16rem' }}
         | 
| 141 102 | 
             
                    />
         | 
| 142 103 | 
             
                  ) : null}
         | 
| 143 | 
            -
             | 
| 144 104 | 
             
                  <Box
         | 
| 145 105 | 
             
                    css={{
         | 
| 146 106 | 
             
                      mt: '$4',
         | 
| @@ -156,30 +116,36 @@ export const VBPicker = ({ backgroundMedia = [] }: { backgroundMedia: VirtualBac | |
| 156 116 | 
             
                        {
         | 
| 157 117 | 
             
                          title: 'No effect',
         | 
| 158 118 | 
             
                          icon: <CrossCircleIcon style={iconDims} />,
         | 
| 159 | 
            -
                           | 
| 160 | 
            -
                          onClick: async () =>  | 
| 119 | 
            +
                          value: HMSVirtualBackgroundTypes.NONE,
         | 
| 120 | 
            +
                          onClick: async () => {
         | 
| 121 | 
            +
                            await VBHandler.removeEffects();
         | 
| 122 | 
            +
                            setActiveBackground(HMSVirtualBackgroundTypes.NONE);
         | 
| 123 | 
            +
                          },
         | 
| 161 124 | 
             
                        },
         | 
| 162 125 | 
             
                        {
         | 
| 163 126 | 
             
                          title: 'Blur',
         | 
| 164 127 | 
             
                          icon: <BlurPersonHighIcon style={iconDims} />,
         | 
| 165 | 
            -
                           | 
| 166 | 
            -
                          onClick: async () =>  | 
| 128 | 
            +
                          value: HMSVirtualBackgroundTypes.BLUR,
         | 
| 129 | 
            +
                          onClick: async () => {
         | 
| 130 | 
            +
                            await VBHandler?.setBlur(0.5);
         | 
| 131 | 
            +
                            setActiveBackground(HMSVirtualBackgroundTypes.BLUR);
         | 
| 132 | 
            +
                          },
         | 
| 167 133 | 
             
                        },
         | 
| 168 134 | 
             
                      ]}
         | 
| 169 | 
            -
                       | 
| 170 | 
            -
                      // @ts-ignore
         | 
| 171 | 
            -
                      activeBackground={vbPlugin.background?.src || vbPlugin.background || HMSVirtualBackgroundTypes.NONE}
         | 
| 135 | 
            +
                      activeBackground={activeBackground}
         | 
| 172 136 | 
             
                    />
         | 
| 173 137 |  | 
| 174 138 | 
             
                    <VBCollection
         | 
| 175 139 | 
             
                      title="Backgrounds"
         | 
| 176 140 | 
             
                      options={mediaList.map(mediaURL => ({
         | 
| 177 | 
            -
                        type: HMSVirtualBackgroundTypes.IMAGE,
         | 
| 178 141 | 
             
                        mediaURL,
         | 
| 179 | 
            -
                         | 
| 142 | 
            +
                        value: mediaURL,
         | 
| 143 | 
            +
                        onClick: async () => {
         | 
| 144 | 
            +
                          await VBHandler?.setBackground(mediaURL);
         | 
| 145 | 
            +
                          setActiveBackground(mediaURL);
         | 
| 146 | 
            +
                        },
         | 
| 180 147 | 
             
                      }))}
         | 
| 181 | 
            -
                       | 
| 182 | 
            -
                      activeBackground={background?.src || background || HMSVirtualBackgroundTypes.NONE}
         | 
| 148 | 
            +
                      activeBackground={activeBackground}
         | 
| 183 149 | 
             
                    />
         | 
| 184 150 | 
             
                  </Box>
         | 
| 185 151 | 
             
                </Flex>
         | 
| @@ -1,5 +1,3 @@ | |
| 1 | 
            -
            import { HMSVBPlugin, HMSVirtualBackgroundTypes } from '@100mslive/hms-virtual-background';
         | 
| 2 | 
            -
             | 
| 3 1 | 
             
            export const defaultMedia = [
         | 
| 4 2 | 
             
              'https://assets.100ms.live/webapp/vb-mini/vb-1.jpg',
         | 
| 5 3 | 
             
              'https://assets.100ms.live/webapp/vb-mini/vb-2.jpg',
         | 
| @@ -14,5 +12,3 @@ export const defaultMedia = [ | |
| 14 12 | 
             
              'https://assets.100ms.live/webapp/vb-mini/vb-11.jpg',
         | 
| 15 13 | 
             
              'https://assets.100ms.live/webapp/vb-mini/vb-12.jpg',
         | 
| 16 14 | 
             
            ];
         | 
| 17 | 
            -
             | 
| 18 | 
            -
            export const vbPlugin = new HMSVBPlugin(HMSVirtualBackgroundTypes.NONE, HMSVirtualBackgroundTypes.NONE);
         | 
| @@ -32,6 +32,11 @@ const SidePane = ({ | |
| 32 32 | 
             
              const trackId = useHMSStore(selectVideoTrackByPeerID(activeScreensharePeerId))?.id;
         | 
| 33 33 | 
             
              const { elements } = useRoomLayoutConferencingScreen();
         | 
| 34 34 | 
             
              const { elements: preview_elements } = useRoomLayoutPreviewScreen();
         | 
| 35 | 
            +
             | 
| 36 | 
            +
              const backgroundMedia = preview_elements?.virtual_background?.background_media?.length
         | 
| 37 | 
            +
                ? preview_elements?.virtual_background?.background_media
         | 
| 38 | 
            +
                : elements?.virtual_background?.background_media || [];
         | 
| 39 | 
            +
             | 
| 35 40 | 
             
              const resetSidePane = useSidepaneReset();
         | 
| 36 41 | 
             
              let ViewComponent;
         | 
| 37 42 | 
             
              if (sidepane === SIDE_PANE_OPTIONS.POLLS) {
         | 
| @@ -41,7 +46,7 @@ const SidePane = ({ | |
| 41 46 | 
             
                ViewComponent = <SidePaneTabs hideControls={hideControls} active={sidepane} />;
         | 
| 42 47 | 
             
              }
         | 
| 43 48 | 
             
              if (sidepane === SIDE_PANE_OPTIONS.VB) {
         | 
| 44 | 
            -
                ViewComponent = <VBPicker backgroundMedia={ | 
| 49 | 
            +
                ViewComponent = <VBPicker backgroundMedia={backgroundMedia} />;
         | 
| 45 50 | 
             
              }
         | 
| 46 51 |  | 
| 47 52 | 
             
              useEffect(() => {
         | 
| @@ -2,6 +2,7 @@ import type * as Stitches from '@stitches/react'; | |
| 2 2 | 
             
            import { createStitches } from '@stitches/react';
         | 
| 3 3 | 
             
            import merge from 'lodash.merge';
         | 
| 4 4 | 
             
            import { baseConfig, defaultMedia, defaultThemeMap, defaultUtils } from './base.config';
         | 
| 5 | 
            +
            import { DEFAULT_PORTAL_CONTAINER } from '../Prebuilt/common/constants';
         | 
| 5 6 |  | 
| 6 7 | 
             
            const HmsStitches = createStitches({
         | 
| 7 8 | 
             
              prefix: 'hms-ui',
         | 
| @@ -28,18 +29,9 @@ export const { | |
| 28 29 | 
             
            } = HmsStitches;
         | 
| 29 30 |  | 
| 30 31 | 
             
            export const globalStyles = globalCss({
         | 
| 31 | 
            -
               | 
| 32 | 
            +
              [`${DEFAULT_PORTAL_CONTAINER} *`]: {
         | 
| 32 33 | 
             
                fontFamily: '$sans',
         | 
| 33 34 | 
             
                boxSizing: 'border-box',
         | 
| 34 | 
            -
                borderWidth: 0,
         | 
| 35 | 
            -
                borderStyle: 'solid',
         | 
| 36 | 
            -
              },
         | 
| 37 | 
            -
              body: {
         | 
| 38 | 
            -
                margin: 0,
         | 
| 39 | 
            -
              },
         | 
| 40 | 
            -
              '#root': {
         | 
| 41 | 
            -
                height: '100%',
         | 
| 42 | 
            -
                overscrollBehaviorY: 'none',
         | 
| 43 35 | 
             
              },
         | 
| 44 36 | 
             
              '::-webkit-scrollbar-track': {
         | 
| 45 37 | 
             
                WebkitBoxShadow: 'inset 0 0 6px rgba(0, 0, 0, 0.3)',
         |