UNPKG

mediasfu-reactnative-expo

Version:

mediasfu-reactnative-expo – Expo-managed React Native WebRTC SDK for video conferencing, webinars, live streaming, broadcast, screen sharing, whiteboard, chat, recording, live subtitles, translation, and AI agent rooms on iOS, Android, and web. Prebuilt r

39 lines (38 loc) 1.53 kB
/** * 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 'mediasfu-shared'; 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>; 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;