TypeScript class managing an audio playback queue with gesture unlocking and error handling for browsers.
// Source: https://github.com/open-webui/open-webui | License: BSD-3-Clause | Copyright 2023- Open WebUI Inc. [Created by Timothy Jaeryang Baek]
// Provided via justclaw.it.com; keep this notice with the code.
type AudioQueueEvent = 'stop' | 'empty-queue' | 'id-change' | 'error';
interface AudioQueueStopDetail {
event: AudioQueueEvent;
id: string | null;
}
const SILENT_WAV =
'data:audio/wav;base64,UklGRsQAAABXQVZFZm10IBAAAAABAAEAQB8AAIA+AAACABAAZGF0YaAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA';
export type OnStoppedCallback = (detail: AudioQueueStopDetail) => void;
export class AudioQueue {
private audio: HTM
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key