UNPKG

@interactify-live/player-react-native

Version:

React Native library for Interactify player with media display, widgets, and MQTT integration

103 lines (102 loc) 2.74 kB
import { ReactNode } from 'react'; export interface InteractifyPlayerProps { media: { id: string; type: 'video' | 'image'; url: string; thumbnail?: string; alt?: string; }; interactions: any[]; autoPlay?: boolean; muted?: boolean; loop?: boolean; isDraggable?: boolean; onPlay?: () => void; onPause?: () => void; onEnded?: () => void; onTimeUpdate?: (time: number) => void; onError?: (error: Error) => void; onInteractionClick?: (interaction: any) => void; onInteractionDragEnd?: (index: number, geometric: { x: number; y: number; width: number; height: number; }) => void; onVideoReady?: (videoRef: any) => void; loadingIndicator?: ReactNode; errorIndicator?: ReactNode; className?: string; style?: any; /** * Options for Connector (user/session info, etc) */ options?: { user_id: string; token: string; scope: 'short' | 'live'; space_slug: string; slug: string; session: string; brokerUrl?: string; }; /** * Callback for connection status changes */ onStatusChange?: (status: string) => void; /** * Callback for new messages received */ onNewMessageReceived?: (message: any) => void; } export interface InteractifyPlayerHandle { play: () => void; pause: () => void; mute: () => void; unmute: () => void; getCurrentTime: () => number; setCurrentTime: (time: number) => void; isMuted: () => boolean; isPlaying: () => boolean; setInteractions: (interactions: any[]) => void; getVideoElement: () => any; loadStream: (stream: any) => void; /** * Publish an event (e.g., "like") * @param type Event type string */ publishEvent: (type: string) => void; /** * Send a chat message * @param message Message object with text and optional metadata */ sendMessage: (message: { text: string; avatar?: string; displayName?: string; visible?: boolean; replyTo?: { text: string; userID: string; displayName: string; }; }) => void; /** * Subscribe to new messages * @param callback Callback function to receive new messages * @returns Unsubscribe function */ subscribeToNewMessages: (callback: (message: any) => void) => () => void; } export interface PlayerState { isPlaying: boolean; isLoaded: boolean; error: string | null; buffering: boolean; connectionStatus: string; messages: any[]; currentTime: number; duration: number; isMuted: boolean; }