Class RtcAudioSource
- Namespace
- LiveKit
Capture source for a local audio track.
public abstract class RtcAudioSource : IRtcSource, IDisposable
- Inheritance
-
RtcAudioSource
- Implements
- Derived
- Inherited Members
- Extension Methods
Constructors
RtcAudioSource(int, RtcAudioSourceType)
protected RtcAudioSource(int channels = 2, RtcAudioSourceType audioSourceType = RtcAudioSourceType.AudioSourceCustom)
Parameters
channelsintaudioSourceTypeRtcAudioSourceType
Fields
DefaultChannels
public static uint DefaultChannels
Field Value
DefaultMicrophoneSampleRate
public static uint DefaultMicrophoneSampleRate
Field Value
DefaultSampleRate
public static uint DefaultSampleRate
Field Value
_info
protected AudioSourceInfo _info
Field Value
Properties
Muted
public override bool Muted { get; }
Property Value
SourceType
public RtcAudioSourceType SourceType { get; }
Property Value
Methods
Dispose()
Disposes of the audio source, stopping it first if necessary.
public void Dispose()
Dispose(bool)
protected virtual void Dispose(bool disposing)
Parameters
disposingbool
~RtcAudioSource()
protected ~RtcAudioSource()
Prepare(float)
[Obsolete("No longer used, audio sources should perform any preparation in Start() asynchronously")]
public virtual IEnumerator Prepare(float timeout = 0)
Parameters
timeoutfloat
Returns
PrepareAndStart()
[Obsolete("Use Start() instead")]
public IEnumerator PrepareAndStart()
Returns
SetMute(bool)
Mutes or unmutes the audio source.
public override void SetMute(bool muted)
Parameters
mutedbool
Start()
Begin capturing audio samples from the underlying source.
public virtual void Start()
Stop()
Stop capturing audio samples from the underlying source.
public virtual void Stop()
Events
AudioRead
Event triggered when audio samples are captured from the underlying source. Provides the audio data, channel count, and sample rate.
public abstract event Action<float[], int, int> AudioRead
Event Type
Remarks
This event is not guaranteed to be called on the main thread.