> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agentium.in/llms.txt
> Use this file to discover all available pages before exploring further.

# LiveKit media transport

> Bridge Agentium PCM frames to a host-owned LiveKit audio source.

`LiveKitVoiceTransport` implements the media side of `StreamingVoicePipeline`. It is independent of the [LiveKit SIP call adapter](/telephony/livekit).

```bash theme={null}
npm install @agentium/core@4.0.0 @livekit/rtc-node
```

Your host creates and publishes a LiveKit audio source/track, connects the room, and passes the source plus AudioFrame constructor to Agentium. This complete factory accepts those structural ports without importing the native SDK into the documentation example.

```typescript theme={null}
import {
  LiveKitVoiceTransport,
  type LiveKitAudioFrame,
  type LiveKitAudioSource,
  type SpeechFormat,
} from "@agentium/core/voice";

export function createMedia<T extends LiveKitAudioFrame>(
  source: LiveKitAudioSource<T>,
  AudioFrame: new (data: Int16Array, sampleRate: number, channels: number, samplesPerChannel: number) => T,
  inputFormat: SpeechFormat,
) {
  return new LiveKitVoiceTransport({
    source, AudioFrame, inputFormat,
    maxQueuedMs: 500, maxPendingFrames: 16, captureTimeoutMs: 5000,
    ownsSource: false,
  });
}
```

Pass the result as `transport` in [StreamingVoicePipeline](/voice/streaming). Feed received room frames through `fromLiveKitAudioFrame` with a monotonic sequence, turn ID, and generation ID before passing them to the pipeline.

## Format and backpressure

The source and input must use mono PCM16. Output rate comes from the source; input rate comes from `inputFormat`. Resample explicitly when these differ from the selected speech adapters. `fromLiveKitAudioFrame` copies input samples rather than retaining native frame storage.

`queuedDuration` is measured in **milliseconds**. Capture is serialized and bounded by queue time, pending frame count, and timeout. A stuck capture poisons that transport; create a replacement after handling the host source rather than overlapping capture calls.

## Playback and ownership

The transport reports `playbackAcknowledgements: false`. Offering a frame to the source does not prove the caller heard it. Without host playback evidence, history remains delivery-unknown.

Clear a cancelled generation to discard queued audio. Close the pipeline and transport when done. With the default `ownsSource: false`, your host separately unpublishes the track, closes the source, disconnects the room, and disposes native SDK resources. Opt into source ownership only when the transport truly owns it.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.