Member Junction
    Preparing search index...

    The playback contract for a client-owned realtime audio plane: schedules raw PCM16 chunks for gapless playout and reports whether audio is AUDIBLY playing. Production is RealtimePcmPlayback (Web Audio, playhead-clock scheduling); tests inject a fake with a controllable IsPlaying.

    Shared by every websocket driver whose audio plane is client-owned (Gemini Live, ElevenLabs Agents) — WebRTC drivers (OpenAI) get playback from the peer connection instead and don't use this.

    interface IRealtimePcmPlayback {
        IsPlaying: boolean;
        Close(): void;
        CreateMeter?(): IRealtimeAudioMeter;
        Enqueue(pcm16: ArrayBuffer): void;
        Flush(): void;
    }

    Implemented by

    Index

    Properties

    IsPlaying: boolean

    true while scheduled audio is audibly playing (playhead ahead of the context clock).

    Methods

    • OPTIONAL: creates an IRealtimeAudioMeter tapping this engine's output — the AGENT-audio side of the call UI's audio-reactive visuals. Drivers feed it to BaseRealtimeClient's audio-activity surface. Optional so test fakes (and minimal implementations) stay valid; callers use playback.CreateMeter?.() ?? null.

      Returns IRealtimeAudioMeter

    • Schedules a raw PCM16 mono chunk back-to-back after any already-queued audio.

      Parameters

      • pcm16: ArrayBuffer

      Returns void

    • Stops + clears every scheduled source (barge-in / interruption).

      Returns void