mediasfu-reactjs
Version:
mediasfu-reactjs – React 18/19 WebRTC SDK for video conferencing, webinars, broadcasts, live streaming, chat, recording, whiteboard, and AI agents. Plug-in prebuilt rooms or build fully custom UIs.
39 lines • 1.63 kB
TypeScript
/**
* Context for providing live subtitles to video/audio cards.
*
* This allows cards to reactively access subtitle data without
* needing to re-render the entire grid when subtitles change.
*/
import React from 'react';
import type { LiveSubtitle } from '../producers/socketReceiveMethods/translationReceiveMethods';
export interface LiveSubtitleContextValue {
/** Map of speakerId/speakerName to LiveSubtitle */
liveSubtitles: Map<string, LiveSubtitle>;
/** Whether to show subtitles on cards */
showSubtitlesOnCards: boolean;
/** Helper to get subtitle for a speaker by id or name */
getSubtitleForSpeaker: (speakerId: string, speakerName: string) => LiveSubtitle | null;
}
declare const LiveSubtitleContext: React.Context<LiveSubtitleContextValue | null>;
export interface LiveSubtitleProviderProps {
liveSubtitles: Map<string, LiveSubtitle>;
showSubtitlesOnCards: boolean;
children: React.ReactNode;
}
export declare const LiveSubtitleProvider: React.FC<LiveSubtitleProviderProps>;
/**
* Hook to access live subtitle context.
* Returns null if used outside of LiveSubtitleProvider.
*/
export declare const useLiveSubtitles: () => LiveSubtitleContextValue | null;
/**
* Hook to get subtitle for a specific speaker.
* Returns null if no subtitle exists or context is unavailable.
*/
export declare const useSpeakerSubtitle: (speakerId: string, speakerName: string) => LiveSubtitle | null;
/**
* Hook to check if subtitles should be shown.
*/
export declare const useShowSubtitles: () => boolean;
export default LiveSubtitleContext;
//# sourceMappingURL=LiveSubtitleContext.d.ts.map