ez-web-audio
Version:
Making the Web Audio API super EZ since 2024.
29 lines • 890 B
TypeScript
import { AudioError } from './audio-error';
/**
* Error thrown when AudioContext is in an invalid state.
*
* Common causes:
* - AudioContext suspended (not yet resumed after user interaction)
* - AudioContext closed
*
* @example
* ```typescript
* if (audioContext.state === 'suspended') {
* throw new AudioContextError(
* 'AudioContext suspended. Call initAudio() after user interaction (click, tap).',
* audioContext.state
* );
* }
* ```
*/
export declare class AudioContextError extends AudioError {
readonly state: AudioContextState;
/**
* Create a new AudioContextError.
*
* @param message - Human-readable error description with actionable fix
* @param state - The current AudioContext state when the error occurred
*/
constructor(message: string, state: AudioContextState);
}
//# sourceMappingURL=context-error.d.ts.map