UNPKG

vlibras-player-nextjs

Version:

VLibras Player para Next.js - Biblioteca moderna para tradução de texto em Libras com callbacks de estado

109 lines (108 loc) 2.8 kB
import type { UnityPlayerInstance } from '@/types'; export interface UnityPlayerEvents { load: () => void; progress: (_progress: number) => void; stateChange: (_isPlaying: boolean, _isPaused: boolean, _isLoading: boolean) => void; counterGloss: (_counter: number, _length: number) => void; getAvatar: (_avatar: string) => void; finishWelcome: (_finished: boolean) => void; } /** * Adapter para gerenciar a comunicação com o Unity WebGL Player */ export declare class UnityPlayerManager { private static instance; private player; private eventListeners; private subtitle; private currentBaseUrl; constructor(); /** * Define a referência do player Unity */ setPlayerReference(player: UnityPlayerInstance): void; /** * Envia uma mensagem para o Unity */ private sendMessage; /** * Reproduz uma glosa ou continua a reprodução */ play(gloss?: string): void; /** * Pausa a reprodução */ pause(): void; /** * ✅ NOVO: Retoma a reprodução pausada */ resume(): void; /** * ✅ NOVO: Reinicia a animação atual (mesmo se estiver rodando) */ restart(): void; /** * Para toda a reprodução */ stop(): void; /** * Define a velocidade de reprodução */ setSpeed(speed: number): void; /** * Alterna a exibição de legendas */ toggleSubtitle(): void; /** * Reproduz animação de boas-vindas */ playWelcome(): void; /** * Troca o avatar */ changeAvatar(avatarName: string): void; /** * Define a URL base para o dicionário */ setBaseUrl(url: string): void; /** * ✅ CRITICAL FIX: Inicializa animações aleatórias (método do original) */ initRandomAnimationsProcess(): void; /** * Define configurações de personalização */ setPersonalization(personalization: string): void; /** * Adiciona listener para eventos */ addEventListener<K extends keyof UnityPlayerEvents>(event: K, listener: UnityPlayerEvents[K]): void; /** * Remove listener de eventos */ removeEventListener<K extends keyof UnityPlayerEvents>(event: K, listener: UnityPlayerEvents[K]): void; /** * Emite um evento */ private emit; /** * Configura callbacks globais para comunicação com Unity */ private setupGlobalCallbacks; /** * Converte string Unity para boolean */ private toBool; /** * Obtém URL base atual */ getCurrentBaseUrl(): string; /** * Verifica se as legendas estão habilitadas */ isSubtitleEnabled(): boolean; /** * Limpa todos os listeners */ dispose(): void; }