import React from 'react'; import { DailyVideo } from '@daily-co/daily-react'; import { useParticipants } from './useParticipants'; import { useViewMode } from './useViewMode'; import styles from './MainVideo.module.css'; /** * MainVideo component displays the primary participant in the demo experience. * * Dynamically switches between: * - **Discovery Mode**: Tavus AI avatar (camera video) * - **Presentation Mode**: Slidev screenshare (screen video) * * Uses the useViewMode hook to determine which participant to display, * and Daily's DailyVideo component for video rendering. * * @example * ```tsx * * ``` */ export const MainVideo: React.FC = () => { const { tavusAvatar, slideshow } = useParticipants(); const viewMode = useViewMode(); // Determine which participant to show based on view mode const mainParticipant = viewMode === 'presentation' ? slideshow : tavusAvatar; const videoType = viewMode === 'presentation' ? 'screenVideo' : 'video'; // Show loading state if main participant hasn't joined yet if (!mainParticipant) { return (

Waiting for {viewMode === 'presentation' ? 'presentation' : 'presenter'}...

); } return (
{/* Optional: Add debug info in development */} {process.env.NODE_ENV === 'development' && (
Mode: {viewMode} | Type: {videoType}
)}
); };