MediaStreamAudioTrackSource
Audio source that encodes the data of a MediaStreamAudioTrack and pipes it into the output. This is useful for capturing live or real-time audio such as microphones or audio from other media elements. Audio will automatically start being captured once the connected Output is started, and will keep being captured until the Output is finalized or this source is closed.
Extends: AudioSource
Constructor
constructor(
track: MediaStreamAudioTrack,
encodingConfig: AudioEncodingConfig,
): MediaStreamAudioTrackSource;Creates a new MediaStreamAudioTrackSource from a MediaStreamAudioTrack, which will pull audio samples from the stream in real time and encode them according to AudioEncodingConfig.
Properties
errorPromise
get errorPromise(): Promise<void>;A promise that rejects upon any error within this source. This promise never resolves.
paused
get paused(): boolean;Whether this source is currently paused as a result of calling .pause().
Methods
pause()
pause(): void;Pauses the capture of audio data - any audio data emitted by the underlying media stream will be ignored while paused. This does not close the underlying MediaStreamAudioTrack, it just ignores its output.
resume()
resume(): void;Resumes the capture of audio data after being paused.