import React from 'react'; import { GridLayout, ControlBar, useTracks, RoomAudioRenderer, LayoutContextProvider, Chat, } from '@livekit/components-react'; import { Track } from 'livekit-client'; import { ParticipantTile } from './ParticipantTile'; export const CustomVideoLayout: React.FC = () => { const [showChat, setShowChat] = React.useState(false); const tracks = useTracks( [ { source: Track.Source.Camera, withPlaceholder: true }, { source: Track.Source.ScreenShare, withPlaceholder: false }, ], { onlySubscribed: false }, ); return ( {}, }, widget: { state: { showChat, unreadMessages: 0, }, dispatch: (action: any) => { if ('msg' in action && action.msg === 'toggle_chat') { setShowChat((prev) => !prev); } }, }, }} >
{showChat && (
)}
); }; export default CustomVideoLayout;