|
LiveKit C++ SDK
Real-time audio/video SDK for C++
|
#include <local_audio_track.h>


Public Member Functions | |
| void | mute () |
| void | unmute () |
| Unmutes the audio track and resumes sending audio to the room. | |
| std::string | to_string () const |
Public Member Functions inherited from livekit::Track | |
| const std::string & | sid () const noexcept |
| const std::string & | name () const noexcept |
| TrackKind | kind () const noexcept |
| StreamState | stream_state () const noexcept |
| bool | muted () const noexcept |
| bool | remote () const noexcept |
| std::optional< TrackSource > | source () const noexcept |
| std::optional< bool > | simulcasted () const noexcept |
| std::optional< uint32_t > | width () const noexcept |
| std::optional< uint32_t > | height () const noexcept |
| std::optional< std::string > | mime_type () const noexcept |
| bool | has_handle () const noexcept |
| uintptr_t | ffi_handle_id () const noexcept |
| std::future< std::vector< RtcStats > > | getStats () const |
| void | setStreamState (StreamState s) noexcept |
| void | setMuted (bool m) noexcept |
| void | setName (std::string n) noexcept |
Static Public Member Functions | |
| static std::shared_ptr< LocalAudioTrack > | createLocalAudioTrack (const std::string &name, const std::shared_ptr< AudioSource > &source) |
Additional Inherited Members | |
Protected Member Functions inherited from livekit::Track | |
| Track (FfiHandle handle, std::string sid, std::string name, TrackKind kind, StreamState state, bool muted, bool remote) | |
| void | setPublicationFields (std::optional< TrackSource > source, std::optional< bool > simulcasted, std::optional< uint32_t > width, std::optional< uint32_t > height, std::optional< std::string > mime_type) |
Represents a user-provided audio track sourced from the local device.
LocalAudioTrack is used to publish microphone audio (or any custom audio source) to a LiveKit room. It wraps a platform-specific audio source and exposes simple controls such as mute() and unmute().
Typical usage:
auto source = AudioSource::create(...); auto track = LocalAudioTrack::createLocalAudioTrack("mic", source); room->localParticipant()->publishTrack(track);
Muting a local audio track stops transmitting audio to the room, but the underlying source may continue capturing depending on platform behavior.
The track name provided during creation is visible to remote participants and can be used for debugging or UI display.
|
static |
Creates a new local audio track backed by the given AudioSource.
| name | Human-readable name for the track. This may appear to remote participants and in analytics/debug logs. |
| source | The audio source that produces PCM frames for this track. |
LocalAudioTrack. | void livekit::LocalAudioTrack::mute | ( | ) |
Mutes the audio track.
A muted track stops sending audio to the room, but the track remains published and can be unmuted later without renegotiation.
| std::string livekit::LocalAudioTrack::to_string | ( | ) | const |
Returns a human-readable string representation of the track, including its SID and name. Useful for debugging and logging.