diff --git a/packages/uiweb/src/lib/components/space/SpaceWidget/LiveWidgetContent.tsx b/packages/uiweb/src/lib/components/space/SpaceWidget/LiveWidgetContent.tsx index b55972ab6..56777f4e7 100644 --- a/packages/uiweb/src/lib/components/space/SpaceWidget/LiveWidgetContent.tsx +++ b/packages/uiweb/src/lib/components/space/SpaceWidget/LiveWidgetContent.tsx @@ -5,7 +5,7 @@ import * as PushAPI from '@pushprotocol/restapi'; import { SpaceDTO } from '@pushprotocol/restapi'; // livekit imports -import { LiveKitRoom, RoomAudioRenderer } from '@livekit/components-react'; +import { LiveKitRoom, ConnectionState, RoomName, RoomAudioRenderer, ControlBar } from '@livekit/components-react'; import { Room } from 'livekit-client'; import { LiveSpaceProfileContainer } from './LiveSpaceProfileContainer'; @@ -63,7 +63,7 @@ export const LiveWidgetContent: React.FC = ({ const isMicOn = spaceObjectData?.connectionData?.local?.audio; - const numberOfRequests = spaceObjectData.liveSpaceData.listeners.filter((listener: any) => listener.handRaised).length; + // const numberOfRequests = spaceObjectData.liveSpaceData.listeners.filter((listener: any) => listener.handRaised).length; const handleMicState = async () => { await spacesObjectRef?.current?.enableAudio?.({ state: !isMicOn }); @@ -71,12 +71,15 @@ export const LiveWidgetContent: React.FC = ({ useEffect(() => { (async function () { - if(isListener && spaceData?.spaceId) { + if (isListener && spaceData?.spaceId) { const livekitToken = await getLivekitRoomToken({ userType: "receiver", roomId: spaceData?.spaceId }); setLivekitToken(livekitToken.data); + } else if (isHost && spaceData?.spaceId) { + const livekitToken = await getLivekitRoomToken({ userType: "sender", roomId: spaceData?.spaceId }); + setLivekitToken(livekitToken.data); } })(); - }, [isListener, spaceData]); + }, [isListener, isHost, spaceData]); useEffect(() => { if (!spaceObjectData?.connectionData?.local?.stream || !isRequestedForMic) @@ -398,13 +401,13 @@ export const LiveWidgetContent: React.FC = ({ - { + {/* { isHost && numberOfRequests ? {numberOfRequests} : null - } + } */} = ({ {!isHost ? 'Leave' : 'End space'} - {isListener && !isHost && playBackUrl.length > 0 && ( + {/* {isListener && !isHost && playBackUrl.length > 0 && ( - )} - {isListener && !isHost && livekitToken && ( - - - - )} + )} */} ) : (