ProtecteddataProtectedinputMeter over the USER's microphone, when the driver attached one.
ProtectedoutputMeter over the AGENT's audio output, when the driver attached one.
ProtectedsessionProtectedtracksTracks requested, established, or denied on this session.
Static ReadonlyASSISTANT_Static ReadonlyMAX_Static ReadonlyPLAYBACK_Static ReadonlyPLAYBACK_Static ReadonlyPLAYBACK_Static ReadonlyPREBILL_All tracks evaluated for this session (including 'unsupported' or 'denied').
Established tracks on this session (tracks in the 'live' state).
The frame rate (frames per second) the live inbound video track was negotiated at — the model's
ceiling or the session's request, whichever is lower — or undefined when no inbound video track
is live or none declared a rate. Anything pacing a video feed reads THIS, never a constant of its own.
true while model audio is AUDIBLY playing in the browser. Distinct from
IsBusy — audio plays at realtime while generation finishes early, so the
model can be "idle" while speech is still coming out of the speaker. Hosts must
gate narration on BOTH, or queued utterances come out late and stale.
true while a model response is in flight (generation started and not yet done).
Distinct from IsAudioPlaying: generation runs ahead of playback.
Hosts use this to gate interim narration so it never interrupts a reply.
How many concurrent inbound video streams the model accepts: the ceiling the driver declared when it
negotiated tracks, else 1 when an inbound video track is live and 0 when it is not.
A source arbiter reads this to decide whether several live video sources must be narrowed to one (with a note to the model on each switch) or passed through untouched.
Whether the model takes inbound video on this session: the driver declared an inbound video track it supports when it
negotiated tracks, and a stream limit above zero. No video track need be live; one is added when a capture starts
(AddTrack). false before tracks are negotiated, and for a driver that does not negotiate them.
ProtectedSupportsWhether this driver can open a relay session (ClientRealtimeSessionConfig.Transport 'relay'): connect to
MJAPI's realtime relay at the session's RelayUrl rather than to its provider. false here; a driver that speaks
its provider's protocol through the relay opts in by overriding it (the Gemini Enterprise client does).
Adds a track to a running session, such as inbound video when the user starts their camera, resolved against
what the driver supported when it negotiated at connect. The new track is 'live', or 'unsupported' with the
reason (the model takes no such track, or no more inbound video streams). A live track with the same
direction, modality and source is returned as it is. Other tracks keep their ids.
The base re-negotiates locally, which is all a driver needs when its provider accepts the media without a setup change (Gemini Live takes video frames at any time). A driver whose wire must change overrides this and calls it.
The track, or null when the session has not negotiated tracks: before it connects, or with a driver
that does not negotiate them (only the Gemini driver does today).
ProtectedadoptProtectedAssertRefuses a session this driver cannot open: a relay session, unless the driver opts in through SupportsRelayTransport. Every driver calls this first in Connect, before it touches the session's media or opens a connection (driver obligation #11). The message names the provider key and never quotes the relay URL, which carries the relay's ticket.
The session the host asked this driver to open.
ProtectedattachAttaches (replacing + closing any previous) the USER-microphone meter. null detaches.
ProtectedattachAttaches (replacing + closing any previous) the AGENT-output meter. null detaches.
Cancels an active model response and flushes local playback.
ProtectedclearDriver hook for Disconnect: drops the stream AND the handlers. Handlers must not survive
into a later Connect on a reused instance, or a stale host callback would receive the
next session's stream.
ProtectedcloseReleases both meters — every driver calls this from its disconnect/teardown path.
Connects to the OpenAI Live WebRTC endpoint via the application server SDP broker.
Optional_cameraStream: MediaStreamProtectedcreateCreates a hidden <audio> element to sink the model's audio output.
ProtectedcreateCreates the peer connection. Production returns a real RTCPeerConnection.
Tears down the connection, data channel, audio tracks, and audio sink.
ProtectedemitProtectedemitEmits a true barge-in interruption to the registered handler (if any).
ProtectedemitEmits the model/avatar's remote video to the registered handler (video drivers only). A driver with a plain
MediaStream passes it as it is; it is handed on as a 'stream' source.
ProtectedemitEmits a state change to the registered handler (if any).
ProtectedemitEmits a tool-call request to the registered handler (if any).
ProtectedemitEmits a track state change to the registered handler (if any).
ProtectedemitEmits a transcript event to the registered handler (if any).
ProtectedemitEmits a usage update (token deltas for a completed response/turn) to the registered handler (if any).
ProtectedemitEmits a user-speech-onset to the registered handler (if any).
The session's current audible activity, or null when this driver attached no
meters at all (hosts then keep their turn-state-driven visuals). Sampled by hosts
per animation frame — implementations are cheap, allocation-light reads of an
AnalyserNode; no per-call provider traffic.
Returns the AGENT's remote-audio MediaStream when this driver owns a tappable
agent-audio plane (a WebRTC driver's remote track, or a PCM driver's playout output),
or null otherwise. Hosts use it to MIX the agent's voice into a browser-side recording
alongside the mic; null (drivers with no tappable plane, or before the stream lands)
degrades gracefully to mic-only capture. Hosts may still call it as client.GetRemoteMediaStream?.().
Pure read — never mutates.
Returns whether a track of the requested modality and direction is established and 'live'.
ProtectednegotiateNegotiates requested tracks against model capability. Audio (inbound + outbound) is the baseline floor of every realtime session; any additional requested tracks (such as channel video) are unioned onto this baseline floor.
OptionalmaxInboundVideoStreams: numberRegisters the (single) error handler. Receives both fatal transport errors (which are
also followed by an 'error' state change) and non-fatal provider error frames.
Registers the (single) interruption handler.
True barge-in only: fires ONLY when USER INPUT CUT OFF ACTIVE MODEL OUTPUT — a model response in flight or audio audibly playing when the user took the floor. A user simply taking their normal turn while the model is idle is NOT an interruption, and drivers must not report it as one (e.g. a raw "speech started" frame must be gated on whether a response is actually active or audio is playing).
On interruption, drivers must also flush locally-owned playback and report
IsAudioPlaying === false promptly (driver obligation #3). Hosts typically
use this hook to abort in-flight delegated work so a stale result is never narrated
into a conversation that has moved on.
Registers a handler invoked when the agent's remote-audio stream becomes available —
IMMEDIATELY (synchronously) if it has already landed, otherwise when the driver publishes
it (a WebRTC track typically lands AFTER Connect resolves). Lets a host attach the
agent voice to a recording that began before the stream landed. Handler errors are
isolated (logged) so a host bug never disturbs the call. Handlers are session-scoped:
clearRemoteMediaStream (called from Disconnect) drops them.
Registers the (single) remote-VIDEO handler — the model/avatar's video for a VIDEO session (a talking-head the host renders, e.g. as the agent's tile). Invoked once the provider's video is available.
The video is a MediaVideoSource: a live stream (a WebRTC track), or a player that must own the
<video> element (MSE or WebCodecs playout of encoded avatar video). Hosts show either with
AttachVideoSource.
Optional capability: audio-only drivers (the default) never emit — registering is always safe,
but hosts must not assume video arrives. A driver whose model sends video (the server driver declares an
outbound video track in its session's Capabilities.SupportedOutboundTracks, or renders an avatar,
BaseRealtimeModel.SupportsAvatarOutput) calls emitRemoteVideo when it is live.
Invoked with the remote video when it becomes available.
Registers the (single) state-change handler. States may be re-emitted (e.g. repeated
'listening' on successive barge-ins); hosts should treat emissions as idempotent.
Registers the (single) tool-call handler. The host executes the tool and calls SendToolResult with the outcome.
Registers the track-state-change handler — invoked when tracks transition in lifecycle
(e.g. established to 'live', 'denied', or 'unsupported').
Registers the (single) transcript handler. Receives interim deltas (IsFinal: false)
and final turn transcripts (IsFinal: true) for both roles, tagged with their
RealtimeClientTranscript.Kind.
Registers the (single) usage handler.
Emissions carry token deltas for the response/turn that just completed (see
RealtimeClientUsage — deltas preferred; cumulative-only providers must convert
in the driver). Hosts accumulate and relay/persist on their own cadence (e.g. the voice
session service debounces a RelayRealtimeUsage mutation onto the co-agent prompt run).
Optional capability: drivers whose provider exposes no usage telemetry simply never emit — registering a handler is always safe, but hosts must not assume emissions arrive. See RealtimeClientUsage for per-driver availability.
Registers the single handler invoked when the provider's voice-activity detection saw the user start to speak. Fires once per detected onset and may fire again inside one turn after a pause; it carries no text. Unlike OnInterruption, it fires whether or not the model was speaking.
ProtectedpostExchanges local SDP offer for remote answer SDP. Posts to application server broker or direct endpoint.
ProtectedpublishDriver hook: records the agent's remote-audio stream and fans it out to every registered
handler. Passing null (a driver with no tappable plane) just records null and
notifies nobody.
Ends a track on a running session, such as inbound video when the user stops their camera: the track is
reported 'ended' and leaves AllTracks. Audio, the session's floor, cannot be removed.
Whether a track was ended.
Moves the mic senders and the input meter to the stream's current tracks (obligation #10).
replaceTrack needs no renegotiation, so the call carries on.
Requests a brief interim narration utterance during delegated background work.
Injects background context without triggering model speech.
Uses session.thinking.append with content parameter and delegation_id: null.
Injects user text into the live session and requests a model response. SendText implies barge-in and must NOT synthesize a user transcript (obligation #4).
Delivers a completed tool execution result back to the model. OpenAI Live remote reasoning plane requires response.item.create followed by response.create. Client delegation plane uses session.commentary.append with the delegation_id.
OptionalSendStreams one video frame as base64-encoded image data to the model. Optional capability — drivers that support inbound video tracks implement this.
Base64-encoded image data.
OptionalmimeType: stringImage MIME type (defaults to 'image/jpeg').
OptionalsourceId: stringWhich source this frame came from. A driver whose model takes ONE inbound video
stream ignores it (the source arbiter already chose what to send); a driver whose model takes
several routes the frame to the track bound to that SourceID.
true if accepted and sent; false if dropped (throttled, unestablished, etc.).
Mutes or unmutes the microphone capture tracks.
Browser WebRTC client driver for the OpenAI Live Realtime API (
gpt-live-1).Implements the browser-direct WebRTC topology specified in Section 5 of the OpenAI Live plan:
POST /v1/live/sessions), keeping the project API key and session configuration on the trusted server.'oai-events'data channel beforecreateOffer().iceGatheringState === 'complete').session.starton the data channel.session.input_audio.appendandsession.output_audio.deltaare forbidden on the data channel.audio.formatentirely (SDP negotiates codecs).Registered under
'openai-live'and'OpenAILiveRealtime'.