import { RemoteTrack } from 'livekit-client'; import { AvatarStreamError } from './error'; import { Logger } from './logger'; import { ErrorRecoveryManager } from './error-recovery-manager'; /** * Configuration options for audio handling */ export interface AudioConfig { /** Called when audio playback starts */ onPlaying?: () => void; /** Called when audio playback pauses */ onPause?: () => void; /** Called when audio playback ends */ onEnded?: () => void; /** Called when audio playback resumes after a pause */ onResumed?: () => void; /** Enable debug mode for additional logging */ isDebug?: boolean; } /** * Configuration for the audio track manager */ export interface AudioTrackManagerConfig { /** Audio configuration options */ audioConfig?: AudioConfig; /** Error handler callback */ onError?: (error: AvatarStreamError) => void; /** Logger instance */ logger?: Logger; /** Error recovery manager */ errorRecovery?: ErrorRecoveryManager; } /** * Manages audio track subscription, playback, and error recovery */ export declare class AudioTrackManager { private audioHandler; private logger; private errorRecovery; private config; /** * Creates a new audio track manager * @param config Configuration options */ constructor(config?: AudioTrackManagerConfig); /** * Sets up error recovery strategies for audio-related errors * @private */ private setupErrorRecoveryStrategies; /** * Handles an audio error by attempting recovery * @param error The error to handle * @returns Promise resolving to the recovery result * @private */ private handleAudioError; /** * Attaches an audio track to the audio handler * @param track The remote track to attach * @throws Error if track attachment fails */ attachAudioTrack(track: RemoteTrack): Promise; /** * Pauses audio playback */ pause(): void; /** * Resumes audio playback * @throws Error if playback cannot be resumed */ play(): Promise; /** * Cleans up resources */ cleanup(): void; /** * Checks if audio is currently playing * @returns True if audio is playing */ isPlaying(): boolean; /** * Checks if the audio handler is ready to play * @returns True if ready */ isReady(): boolean; /** * Gets the current media stream * @returns The current media stream, or null if none */ getCurrentStream(): MediaStream | null; }