LiveKit C++ Client SDK v1.1.0
Real-time audio/video/data SDK for C++
Loading...
Searching...
No Matches
local_video_track.h
1/*
2 * Copyright 2025 LiveKit
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an “AS IS” BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#pragma once
18
19#include <memory>
20#include <string>
21
22#include "livekit/local_track_publication.h"
23#include "livekit/track.h"
24#include "livekit/visibility.h"
25
26namespace livekit {
27
28namespace proto {
29class OwnedTrack;
30}
31
32class VideoSource;
33
55class LIVEKIT_API LocalVideoTrack : public Track {
56public:
66 static std::shared_ptr<LocalVideoTrack> createLocalVideoTrack(const std::string& name,
67 const std::shared_ptr<VideoSource>& source);
68
73 void mute();
74
76 void unmute();
77
80 std::string toString() const;
81
84 std::shared_ptr<LocalTrackPublication> publication() const noexcept { return local_publication_; }
85
90 void setPublication(const std::shared_ptr<LocalTrackPublication>& publication) noexcept override {
91 local_publication_ = publication;
92 }
93
94private:
95 explicit LocalVideoTrack(FfiHandle handle, const proto::OwnedTrack& track);
96
99 std::shared_ptr<LocalTrackPublication> local_publication_;
100};
101
102} // namespace livekit
RAII wrapper for an FFI handle (uintptr_t) coming from Rust.
Definition ffi_handle.h:29
Represents a user-provided video track sourced from the local device.
Definition local_video_track.h:55
std::shared_ptr< LocalTrackPublication > publication() const noexcept
Returns the publication that owns this track, or nullptr if the track is not published.
Definition local_video_track.h:84
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.
void setPublication(const std::shared_ptr< LocalTrackPublication > &publication) noexcept override
Sets the publication that owns this track.
Definition local_video_track.h:90
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.
void mute()
Mutes the video track.
Base class for local and remote media tracks.
Definition track.h:77
Public API for the LiveKit C++ Client SDK.
Definition audio_frame.h:25