diff --git a/frontend/src/contexts/TTSContext.tsx b/frontend/src/contexts/TTSContext.tsx index 03f0aa02..58cde886 100644 --- a/frontend/src/contexts/TTSContext.tsx +++ b/frontend/src/contexts/TTSContext.tsx @@ -31,24 +31,11 @@ interface SpeechRequest { onEnd?: (reason: TTSEndReason, error?: string) => void } -/** - * Returns whether a rejection is the browser refusing playback outside a user gesture. - * - * @param error The rejection value from play(). - * @returns True for a NotAllowedError. - */ function isNotAllowedError(error: unknown): boolean { if (typeof error !== 'object' || error === null) return false return (error as { name?: unknown }).name === 'NotAllowedError' } -/** - * Picks the message shown for a failed playback. - * - * @param error The rejection value from play(). - * @param fallback The message to use when the rejection carries none. - * @returns The message to surface to the user. - */ function playbackErrorMessage(error: unknown, fallback: string): string { if (isNotAllowedError(error)) return PLAYBACK_BLOCKED_MESSAGE return error instanceof Error && error.message ? error.message : fallback diff --git a/frontend/src/contexts/tts-context.ts b/frontend/src/contexts/tts-context.ts index 6921c030..123f5dd7 100644 --- a/frontend/src/contexts/tts-context.ts +++ b/frontend/src/contexts/tts-context.ts @@ -23,13 +23,6 @@ export interface TTSContextValue { speakWithConfig: (text: string, config: TTSConfig) => Promise speakMessage: (messageId: string, text: string, options?: SpeakMessageOptions) => Promise queueMessage: (messageId: string, text: string) => void - /** - * Primes the shared audio element inside a user gesture so a reply that - * arrives later is allowed to start playing. Must be called synchronously from - * the gesture handler. Does nothing while audio is already in use or once the - * element is primed, and does nothing for the builtin Web Speech provider, - * which keeps its own gesture requirement. - */ unlock: () => void stop: () => void pause: () => void