Hiyve Components - v1.0.0
    Preparing search index...

    Interface VideoGridProps

    Props for the VideoGrid component.

    VideoGrid is a container component that manages the layout of video tiles for a video conferencing session. Must be used inside a <HiyveProvider>.

    It automatically handles:

    • Local video tile placement
    • Remote participant tile arrangement (from context)
    • Layout transitions between grid, speaker, and sidebar modes
    • Dominant speaker highlighting (from context)
    • Recording/streaming indicators (from context)
    • Mood analysis display (from MoodAnalysisProvider if available)
    • Responsive resizing

    The component uses absolute positioning to prevent video element remounting when the layout changes, ensuring smooth transitions.

    Basic usage inside HiyveProvider:

    import { HiyveProvider } from '@hiyve/react';
    import { VideoGrid } from '@hiyve/react-ui';

    function VideoRoom() {
    return (
    <HiyveProvider client={client} roomName={roomName} userId={userId}>
    <VideoGrid
    localVideoElementId="local-video"
    localUserName="Me"
    layout="grid"
    showLocalFlip={true}
    showMuteIndicators={true}
    />
    </HiyveProvider>
    );
    }

    Speaker mode with timer:

    <VideoGrid
    localVideoElementId="local-video"
    localUserName="Presenter"
    layout="speaker"
    showTimer
    />
    interface VideoGridProps {
        colors?: Partial<VideoGridColors>;
        controlPosition?: OverlayPosition;
        customLayoutHandler?: CustomLayoutHandler;
        engagementPosition?: OverlayPosition;
        gap?: number;
        hideLocalTile?: boolean;
        indicatorPosition?: OverlayPosition;
        labelPosition?: OverlayPosition;
        layout?: string;
        localTileColors?: Partial<LocalVideoTileColors>;
        localTileIcons?: Partial<LocalVideoTileIcons>;
        localTileLabels?: Partial<LocalVideoTileLabels>;
        localTileOverlayOrder?: LocalVideoTileOverlayElement[];
        localTileRenderProps?: LocalVideoTileRenderProps;
        localTileStyles?: Partial<LocalVideoTileStyles>;
        localUserName?: string;
        localVideoElementId: string;
        minTileWidth?: number;
        moodPosition?: OverlayPosition;
        onError?: (error: Error) => void;
        onLocalClick?: () => void;
        onParticipantClick?: (userId: string) => void;
        participants?: Participant[];
        renderProps?: VideoGridRenderProps;
        showEngagement?: boolean;
        showFit?: boolean;
        showLocalFlip?: boolean;
        showMood?: boolean;
        showMuteIndicators?: boolean;
        showNames?: boolean;
        showTimer?: boolean;
        showZoom?: boolean;
        statusPosition?: OverlayPosition;
        styles?: Partial<VideoGridStyles>;
        sx?: SxProps<Theme>;
        tileColors?: Partial<VideoTileColors>;
        tileIcons?: Partial<VideoTileIcons>;
        tileLabels?: Partial<VideoTileLabels>;
        tileOverlayOrder?: VideoTileOverlayElement[];
        tileRenderProps?: VideoTileRenderProps;
        tileStyles?: Partial<VideoTileStyles>;
        timerPosition?: OverlayPosition;
    }
    Index

    Properties

    colors?: Partial<VideoGridColors>

    Custom colors for the VideoGrid container.

    VideoGridColors for available options.

    controlPosition?: OverlayPosition

    Position of control buttons (flip, zoom) on local tile.

    'bottom-right'
    
    customLayoutHandler?: CustomLayoutHandler

    Custom layout handler for implementing custom layout modes.

    When the layout prop is not one of the built-in modes ('grid', 'speaker', 'sidebar'), this handler is called to calculate tile positions. If no handler is provided for a custom layout, the grid layout is used as a fallback.

    // "Focus" layout - large center tile with small corners
    const focusLayout: CustomLayoutHandler = ({ availableWidth, availableHeight, participants, padding }) => {
    const positions: Record<string, TilePosition> = {};
    const cornerSize = 120;

    // Local user in large center area
    positions['local'] = {
    left: padding + cornerSize,
    top: padding + cornerSize,
    width: availableWidth - cornerSize * 2,
    height: availableHeight - cornerSize * 2,
    };

    // Participants in corners
    const corners = [
    { left: padding, top: padding },
    { left: padding + availableWidth - cornerSize, top: padding },
    { left: padding, top: padding + availableHeight - cornerSize },
    { left: padding + availableWidth - cornerSize, top: padding + availableHeight - cornerSize },
    ];

    participants.forEach((p, i) => {
    if (i < corners.length) {
    positions[p.userId] = {
    ...corners[i],
    width: cornerSize,
    height: cornerSize,
    };
    }
    });

    return positions;
    };

    <VideoGrid
    layout="focus"
    customLayoutHandler={focusLayout}
    />
    engagementPosition?: OverlayPosition

    Position of engagement indicator on video tiles.

    'top-left'
    
    gap?: number

    Gap between tiles in pixels.

    8
    
    hideLocalTile?: boolean

    Hide the local video tile from the grid. When true, the local tile is hidden (display: none) but remains in the DOM so the video element stays attached for WebRTC streaming. Remote participants still see the local user's video.

    false
    
    indicatorPosition?: OverlayPosition

    Position of recording/streaming indicator on local tile.

    'top-left'
    
    labelPosition?: OverlayPosition

    Position of name labels on tiles.

    'bottom-left'
    
    layout?: string

    Layout mode for arranging video tiles.

    'grid'
    

    LayoutMode for available modes.

    localTileColors?: Partial<LocalVideoTileColors>

    Custom colors for the local VideoTile component. Includes overlay, recording indicator, and mute colors.

    localTileIcons?: Partial<LocalVideoTileIcons>

    Custom icons for the local VideoTile component. Replace default flip, fullscreen, and record icons.

    localTileLabels?: Partial<LocalVideoTileLabels>

    Custom labels for the local VideoTile component. Use for i18n/localization of control tooltips.

    localTileOverlayOrder?: LocalVideoTileOverlayElement[]

    Render order for overlay elements on the local tile when they share the same position. Elements listed first appear first (leftmost for horizontal layouts).

    ['indicator', 'timer', 'engagement', 'mood', 'name', 'status', 'controls']
    
    localTileRenderProps?: LocalVideoTileRenderProps

    Render props for the local VideoTile component. Allows custom overlay and duration formatting.

    localTileStyles?: Partial<LocalVideoTileStyles>

    Custom styles for the local VideoTile component. Controls button sizing, animation, and typography.

    localUserName?: string

    Display name for the local user. Shown on the local video tile with "(You)" suffix.

    localVideoElementId: string

    HTML element ID for the local video element. This ID must match the one used when calling client.connectTransports().

    Hiyve client attaches the local video stream to an element with this ID. The VideoGrid creates the video element internally.

    // In your component
    <VideoGrid localVideoElementId="local-video" />

    // When connecting Hiyve
    await client.connectTransports({
    localVideoElementId: 'local-video',
    });
    minTileWidth?: number

    Minimum tile width in pixels. Used to calculate grid columns in auto-layout mode.

    200
    
    moodPosition?: OverlayPosition

    Position of mood indicator on video tiles.

    'top-left'
    
    onError?: (error: Error) => void

    Callback when an error occurs during grid rendering

    onLocalClick?: () => void

    Callback when the local tile is clicked.

    onParticipantClick?: (userId: string) => void

    Callback when a remote participant's tile is clicked.

    Type Declaration

      • (userId: string): void
      • Parameters

        • userId: string

          The clicked participant's user ID

        Returns void

    participants?: Participant[]

    Override the participants array (otherwise derived from HiyveProvider context). Use this when you need full control over which participants are displayed.

    Participant for the required data structure.

    renderProps?: VideoGridRenderProps

    Render props for advanced VideoGrid customization.

    VideoGridRenderProps for available render functions.

    showEngagement?: boolean

    Show engagement indicators on video tiles. Requires MoodAnalysisProvider to be available.

    false
    
    showFit?: boolean

    Show fit/fill toggle button on video tiles.

    false
    
    showLocalFlip?: boolean

    Show the flip/mirror button on the local video tile.

    true
    
    showMood?: boolean

    Show mood indicators on video tiles. When undefined, automatically enabled if MoodAnalysisProvider is available and enabled.

    undefined (auto-detect)
    
    showMuteIndicators?: boolean

    Show mute status indicators (mic/camera icons).

    true
    
    showNames?: boolean

    Show participant names on video tiles.

    true
    
    showTimer?: boolean

    Show room duration timer on local tile. Timer starts from when the room was created (from context).

    false
    
    showZoom?: boolean

    Show the fullscreen/zoom button on video tiles.

    false
    
    statusPosition?: OverlayPosition

    Position of status indicators (mute, hand raised) on remote tiles.

    'top-right'
    
    styles?: Partial<VideoGridStyles>

    Custom styles for VideoGrid layout.

    VideoGridStyles for available options.

    sx?: SxProps<Theme>

    MUI sx prop for additional styling on the container.

    tileColors?: Partial<VideoTileColors>

    Custom colors for remote VideoTile components. Includes avatar palette, indicator colors, etc.

    tileIcons?: Partial<VideoTileIcons>

    Custom icons for remote VideoTile components. Replace default Material-UI icons with custom ones.

    tileLabels?: Partial<VideoTileLabels>

    Custom labels for remote VideoTile components. Use for i18n/localization of tooltip text.

    tileOverlayOrder?: VideoTileOverlayElement[]

    Render order for overlay elements on remote tiles when they share the same position. Elements listed first appear first (leftmost for horizontal layouts).

    ['engagement', 'mood', 'name', 'status', 'controls']
    
    tileRenderProps?: VideoTileRenderProps

    Render props for remote VideoTile components. Allows custom avatar and overlay rendering.

    tileStyles?: Partial<VideoTileStyles>

    Custom styles for remote VideoTile components. Controls spacing, sizing, and typography.

    timerPosition?: OverlayPosition

    Position of timer on local tile.

    'top-right'