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

    Interface MoodAnalysisContextValue

    Context value provided by MoodAnalysisProvider.

    Access this via the useMoodAnalysis() hook or useMoodAnalysisSafe() hook.

    1. moodStates Map - All mood states keyed by userId
    2. getMoodState(userId) - Get a specific participant's mood
    3. useMoodState(userId) - Hook for a specific user (re-renders on change)
    function MoodDisplay() {
    const {
    moodStates, // Map<string, MoodState>
    getMoodState, // (userId: string) => MoodState | undefined
    enabled, // boolean
    ready, // boolean
    loading, // boolean
    error, // Error | null
    } = useMoodAnalysis();

    // Iterate all participants
    moodStates.forEach((state, userId) => {
    console.log(`${userId}: ${state.emotion}`);
    });

    // Get specific participant
    const hostMood = getMoodState('host-id');
    }
    interface MoodAnalysisContextValue {
        addVideo: (
            userId: string,
            element: HTMLVideoElement,
            isLocal?: boolean,
        ) => void;
        disable: () => void;
        enable: () => void;
        enabled: boolean;
        error: Error | null;
        getMoodState: (userId: string) => MoodAnalysisMoodState | undefined;
        loading: boolean;
        moodStates: Map<string, MoodAnalysisMoodState>;
        ready: boolean;
        removeVideo: (userId: string) => void;
        setEnabled: (enabled: boolean) => void;
    }
    Index

    Properties

    addVideo: (userId: string, element: HTMLVideoElement, isLocal?: boolean) => void

    Register a video element for mood analysis. Call this when a participant joins or their video becomes available.

    Type Declaration

      • (userId: string, element: HTMLVideoElement, isLocal?: boolean): void
      • Parameters

        • userId: string

          The participant's user ID

        • element: HTMLVideoElement

          The HTML video element showing their video

        • OptionalisLocal: boolean

          Whether this is the local user's video

        Returns void

    disable: () => void

    Disable mood analysis programmatically. This allows child components to turn off mood analysis without needing to control the provider's enabled prop.

    enable: () => void

    Enable mood analysis programmatically. This allows child components to turn on mood analysis without needing to control the provider's enabled prop.

    enabled: boolean

    Whether mood analysis is currently enabled.

    error: Error | null

    Any error that occurred during initialization.

    getMoodState: (userId: string) => MoodAnalysisMoodState | undefined

    Get the mood state for a specific participant.

    Type Declaration

    loading: boolean

    Whether the analyzer is currently loading.

    moodStates: Map<string, MoodAnalysisMoodState>

    Current mood states for all registered participants. Map of userId -> MoodState

    ready: boolean

    Whether the analyzer is ready (loaded and initialized).

    removeVideo: (userId: string) => void

    Unregister a video element from mood analysis. Call this when a participant leaves or their video is removed.

    Type Declaration

      • (userId: string): void
      • Parameters

        • userId: string

          The participant's user ID to remove

        Returns void

    setEnabled: (enabled: boolean) => void

    Set the enabled state programmatically.

    Type Declaration

      • (enabled: boolean): void
      • Parameters

        • enabled: boolean

          Whether to enable or disable mood analysis

        Returns void