|
LiveKit C++ Client SDK v1.1.0
Real-time audio/video/data SDK for C++
|
Represents a user-provided video track sourced from the local device. More...
#include <local_video_track.h>


Public Member Functions | |
| void | mute () |
| Mutes the video track. | |
| void | unmute () |
| Unmutes the video track and resumes sending video to the room. | |
| std::string | toString () const |
| Returns a human-readable string representation of the track, including its SID and name. | |
| std::shared_ptr< LocalTrackPublication > | publication () const noexcept |
| Returns the publication that owns this track, or nullptr if the track is not published. | |
| void | setPublication (const std::shared_ptr< LocalTrackPublication > &publication) noexcept override |
| Sets the publication that owns this track. | |
Public Member Functions inherited from livekit::Track | |
| const std::string & | sid () const noexcept |
| const std::string & | name () const noexcept |
| TrackKind | kind () const noexcept |
| StreamState | streamState () 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 > | mimeType () const noexcept |
| bool | hasHandle () const noexcept |
| uintptr_t | ffiHandleId () 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< LocalVideoTrack > | createLocalVideoTrack (const std::string &name, const std::shared_ptr< VideoSource > &source) |
Creates a new local video track backed by the given VideoSource. | |
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 video track sourced from the local device.
LocalVideoTrack is used to publish camera video (or any custom video source) to a LiveKit room. It wraps a platform-specific video source and exposes simple controls such as mute() and unmute().
Typical usage:
auto source = std::make_shared<VideoSource>(1280, 720); auto track = LocalVideoTrack::createLocalVideoTrack("cam", source); if (auto lp = room->localParticipant().lock()) { lp->publishTrack(track); } // Capture frames on the video thread via source, not via the track.
Muting a local video track stops transmitting video 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 video track backed by the given VideoSource.
| name | Human-readable name for the track. This may appear to remote participants and in analytics/debug logs. |
| source | The video source that produces video frames for this track. The caller retains ownership and should use this source directly for frame capture. |
LocalVideoTrack. | void livekit::LocalVideoTrack::mute | ( | ) |
Mutes the video track.
A muted track stops sending video to the room, but the track remains published and can be unmuted later without renegotiation.
|
inlineoverridevirtualnoexcept |
Sets the publication that owns this track.
Note: std::move on a const& silently falls back to a copy, so we assign directly. Changing the virtual signature to take by value would enable a true move but is a API-breaking change hence left for a future revision.
Reimplemented from livekit::Track.
| std::string livekit::LocalVideoTrack::toString | ( | ) | const |
Returns a human-readable string representation of the track, including its SID and name.
Useful for debugging and logging.