WebRTCInputConfig
Configuration for WebRTCInput.
Defined in: src/providers/input/WebRTCInput.ts:112
Configuration for WebRTCInput.
Remarks
A source may be supplied up-front via track or stream, or attached later (and swapped live) with setTrack() / setStream(). If both track and stream are provided, track wins.
Example
import { WebRTCInput } from 'composite-voice';
// Source known up-front
const input = new WebRTCInput({ track: remoteTrack, targetSampleRate: 16000 });
// Source attached later
const lateInput = new WebRTCInput();
pc.ontrack = (e) => lateInput.setTrack(e.track);
See
WebRTCInput for where this config is consumed
Properties
| Property | Type | Default value | Description | Defined in |
|---|---|---|---|---|
debug? | boolean | false | Whether to enable debug logging for this provider. | src/providers/input/WebRTCInput.ts:150 |
stream? | MediaStream | undefined | Remote media stream to consume. Remarks The stream’s audio is mixed by the browser’s MediaStreamAudioSourceNode; only the first audio track’s mix is captured (mono downmix). | src/providers/input/WebRTCInput.ts:131 |
targetSampleRate? | number | 16000 | Sample rate (Hz) of the PCM emitted to the pipeline. Remarks The provider requests an AudioContext at this rate; if the browser cannot honor it, audio is downsampled to this rate before emission. Most STT providers perform best at 16000 Hz. | src/providers/input/WebRTCInput.ts:143 |
track? | MediaStreamTrack | undefined | Remote audio track to consume. Remarks Typically obtained from RTCPeerConnection’s ontrack event or from a WebRTC SDK (LiveKit RemoteAudioTrack.mediaStreamTrack, Daily, etc.). Takes precedence over stream when both are provided. | src/providers/input/WebRTCInput.ts:122 |