LiveKitRtcConnection
Voice connection using LiveKit RTC. Used when Fluxer routes voice to LiveKit.
Supports both audio playback (play) and video streaming (playVideo) to voice channels.
Video uses node-webcodecs for decoding (no ffmpeg subprocess). Audio uses prism-media WebM demuxer.
Extends EventEmitter
Constructor
(client: Client, channel: VoiceChannel, : string)| Param | Type | Description |
|---|---|---|
| client | Client | The Fluxer client instance |
| channel | VoiceChannel | The voice channel to connect to |
| _userId | string | The user ID (reserved for future use) |
Properties
: Set<string> (readonly): AudioSource | null: LocalAudioTrack | null: VoiceChannel (readonly): Client (readonly): { destroy?: () => void } | null: { destroy?: () => void } | null: string (readonly): string | null: string | null: Map<string, string> (readonly): boolean (readonly)Whether audio is currently playing.
: boolean (readonly)Whether a video track is currently playing in the voice channel.
: Map<string, LiveKitReceiveSubscription> (readonly): Map<string, boolean> (readonly): Room | null: VideoSource | null: LocalVideoTrack | nullMethods
(msg: string, data?: object): void| Param | Type | Description |
|---|---|---|
| msg | string | |
| data? | object |
(): void(server: GatewayVoiceServerUpdateDispatchData, : GatewayVoiceStateUpdateDispatchData): Promise<void>Connect to the LiveKit room using voice server and state from the gateway. Called internally by VoiceManager; typically not used directly.
| Param | Type | Description |
|---|---|---|
| server | GatewayVoiceServerUpdateDispatchData | Voice server update data (endpoint, token) |
| _state | GatewayVoiceStateUpdateDispatchData | Voice state update data (session, channel) |
(msg: string, data?: object | string): void| Param | Type | Description |
|---|---|---|
| msg | string | |
| data? | object | string |
(): voidDisconnect from the room and remove all event listeners.
(): voidDisconnect from the LiveKit room and stop all playback.
(source: string): void| Param | Type | Description |
|---|---|---|
| source | string |
(participant: RemoteParticipant): string| Param | Type | Description |
|---|---|---|
| participant | RemoteParticipant |
(): numberGet current volume (0-200).
(track: RemoteTrack): boolean| Param | Type | Description |
|---|---|---|
| track | RemoteTrack |
(): booleanReturns true if the LiveKit room is connected and not destroyed.
(endpoint: string | null, token: string): booleanReturns true if we're already connected to the given server (skip migration).
| Param | Type | Description |
|---|---|---|
| endpoint | string | null | Voice server endpoint from the gateway |
| token | string | Voice server token |
(urlOrStream: string | NodeJS.ReadableStream): Promise<void>Play audio from a WebM/Opus source. Publishes to the LiveKit room as an audio track. When `urlOrStream` is a string: `http(s)://` is fetched; `file://` or any other string is read from the local filesystem (path). Otherwise pass a Node.js ReadableStream.
| Param | Type | Description |
|---|---|---|
| urlOrStream | string | NodeJS.ReadableStream | WebM/Opus HTTP(S) URL, `file://` URL, filesystem path, or ReadableStream |
(: NodeJS.ReadableStream): void| Param | Type | Description |
|---|---|---|
| _stream | NodeJS.ReadableStream |
(urlOrBuffer: string | ArrayBuffer | Uint8Array, options?: VideoPlayOptions): Promise<void>Play video from an MP4 URL or buffer. Streams decoded frames to the LiveKit room as a video track. Uses node-webcodecs for decoding (no ffmpeg). Supports H.264 (avc1) and H.265 (hvc1/hev1) codecs.
| Param | Type | Description |
|---|---|---|
| urlOrBuffer | string | ArrayBuffer | Uint8Array | Video source: HTTP(S) URL to an MP4 file, or raw ArrayBuffer/Uint8Array of MP4 data |
| options? | VideoPlayOptions | Optional playback options (see VideoPlayOptions) |
(url: string, options?: VideoPlayOptions): Promise<void>FFmpeg-based video playback. Bypasses node-webcodecs to avoid libc++abi crashes on macOS. Requires ffmpeg and ffprobe in PATH. URL input only.
| Param | Type | Description |
|---|---|---|
| url | string | |
| options? | VideoPlayOptions |
(volumePercent: number): voidSet playback volume (0-200, 100 = normal). Affects current and future playback.
| Param | Type | Description |
|---|---|---|
| volumePercent | number |
(): voidStop playback and clear both audio and video tracks.
(): void(participantId: string, options: { autoResubscribe?: boolean; }): LiveKitReceiveSubscription| Param | Type | Description |
|---|---|---|
| participantId | string | |
| options | { autoResubscribe?: boolean; } |
(participant: RemoteParticipant, track: RemoteTrack, options: { autoSubscribe?: boolean; }): void| Param | Type | Description |
|---|---|---|
| participant | RemoteParticipant | |
| track | RemoteTrack | |
| options | { autoSubscribe?: boolean; } |