Skip to content

Commit 7e7153e

Browse files
fix and improve the cpp docs home page and readme (#52)
1 parent 40cde81 commit 7e7153e

3 files changed

Lines changed: 117 additions & 14 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# LiveKit C++ Client SDK
1+
# Build & Installation Guide
22

3-
This SDK enables native C++ applications to connect to LiveKit servers for real-time audio/video communication.
3+
This page covers how to build and install the LiveKit C++ Client SDK for real-time audio/video communication.
44

55
---
66

docs/Doxyfile

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727
# Project related configuration options
2828
#---------------------------------------------------------------------------
2929

30-
PROJECT_NAME = "LiveKit C++ SDK"
31-
3230
# This tag specifies the encoding used for all characters in the configuration
3331
# file that follow. The default is UTF-8 which is also the encoding used for all
3432
# text before the first occurrence of this tag. Doxygen uses libiconv (or the
@@ -44,7 +42,7 @@ DOXYFILE_ENCODING = UTF-8
4442
# title of most generated pages and in a few other places.
4543
# The default value is: My Project.
4644

47-
PROJECT_NAME = "My Project"
45+
PROJECT_NAME = "LiveKit C++ SDK"
4846

4947
# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
5048
# could be handy for archiving the generated documentation or if some version
@@ -56,7 +54,7 @@ PROJECT_NUMBER =
5654
# for a project that appears at the top of each page and should give viewers a
5755
# quick idea about the purpose of the project. Keep the description short.
5856

59-
PROJECT_BRIEF =
57+
PROJECT_BRIEF = "Real-time audio/video SDK for C++"
6058

6159
# With the PROJECT_LOGO tag one can specify a logo or an icon that is included
6260
# in the documentation. The maximum height of the logo should not exceed 55

docs/index.md

Lines changed: 113 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,119 @@
1-
# Introduction
1+
# LiveKit C++ Client SDK
22

3-
This site contains API reference for the LiveKit C++ SDK.
3+
Build real-time audio/video applications in C++ with LiveKit.
44

5-
> [!WARNING]
6-
> This SDK is currently in Developer Preview mode and not ready for production use.
7-
> There will be bugs and APIs may change during this period.
5+
> **Note:** This SDK is currently in Developer Preview. APIs may change before the stable release.
86
9-
**Additional Resources**
7+
## Quick Start
8+
9+
```cpp
10+
#include "livekit/livekit.h"
11+
12+
bool initializeLivekit(const std::string& url, const std::string& token) {
13+
// Init LiveKit
14+
livekit::initialize(livekit::LogSink::kConsole);
15+
16+
room_ = std::make_unique<livekit::Room>();
17+
livekit::RoomOptions options;
18+
options.auto_subscribe = true;
19+
options.dynacast = false;
20+
if (!room_->Connect(url, token, options)) {
21+
std::cerr << "Failed to connect\n";
22+
livekit::shutdown();
23+
return false;
24+
}
25+
26+
std::cout << "Connected.\n";
27+
28+
// ---- Create & publish AUDIO ----
29+
// Note: Hook up your own audio capture flow to |audioSource_|
30+
audioSource_ = std::make_shared<livekit::AudioSource>(48000, 1, 10);
31+
auto audioTrack = livekit::LocalAudioTrack::createLocalAudioTrack("noise", audioSource_);
32+
33+
livekit::TrackPublishOptions audioOpts;
34+
audioOpts.source = livekit::TrackSource::SOURCE_MICROPHONE;
35+
36+
try {
37+
audioPub_ = room_->localParticipant()->publishTrack(audioTrack, audioOpts);
38+
std::cout << "Published audio: sid=" << audioPub_->sid() << "\n";
39+
} catch (const std::exception& e) {
40+
std::cerr << "Failed to publish audio: " << e.what() << "\n";
41+
return false;
42+
}
43+
44+
// ---- Create & publish VIDEO ----
45+
// Note: Hook up your own video capture flow to |videoSource_|
46+
videoSource_ = std::make_shared<livekit::VideoSource>(1280, 720);
47+
auto videoTrack = livekit::LocalVideoTrack::createLocalVideoTrack("rgb", videoSource_);
48+
49+
livekit::TrackPublishOptions videoOpts;
50+
videoOpts.source = livekit::TrackSource::SOURCE_CAMERA;
51+
52+
try {
53+
videoPub_ = room_->localParticipant()->publishTrack(videoTrack, videoOpts);
54+
std::cout << "Published video: sid=" << videoPub_->sid() << "\n";
55+
} catch (const std::exception& e) {
56+
std::cerr << "Failed to publish video: " << e.what() << "\n";
57+
return false;
58+
}
59+
return true;
60+
}
61+
62+
void shutdownLivekit() {
63+
// Best-effort unpublish
64+
try {
65+
if (room_ && audioPub_)
66+
room_->localParticipant()->unpublishTrack(audioPub_->sid());
67+
if (room_ && videoPub_)
68+
room_->localParticipant()->unpublishTrack(videoPub_->sid());
69+
} catch (...) {
70+
}
71+
72+
audioPub_.reset();
73+
videoPub_.reset();
74+
audioSource_.reset();
75+
videoSource_.reset();
76+
room_.reset();
77+
78+
livekit::shutdown();
79+
}
80+
```
81+
82+
## Key Classes
83+
84+
| Class | Description |
85+
|-------|-------------|
86+
| @ref livekit::Room | Main entry point - connect to a LiveKit room |
87+
| @ref livekit::RoomOptions | Configuration for room connection (auto_subscribe, dynacast, etc.) |
88+
| @ref livekit::LocalParticipant | The local user - publish tracks and send data |
89+
| @ref livekit::RemoteParticipant | Other participants in the room |
90+
| @ref livekit::AudioSource | Audio input source for publishing (sample rate, channels) |
91+
| @ref livekit::VideoSource | Video input source for publishing (width, height) |
92+
| @ref livekit::LocalAudioTrack | Local audio track created from AudioSource |
93+
| @ref livekit::LocalVideoTrack | Local video track created from VideoSource |
94+
| @ref livekit::LocalTrackPublication | Handle to a published local track |
95+
| @ref livekit::TrackPublishOptions | Options for publishing (source type, codec, etc.) |
96+
| @ref livekit::AudioStream | Receive audio from remote participants |
97+
| @ref livekit::VideoStream | Receive video from remote participants |
98+
| @ref livekit::RoomDelegate | Callbacks for room events |
99+
100+
## Installation
101+
102+
See the [GitHub README](https://github.com/livekit/client-sdk-cpp#readme) for build instructions.
103+
104+
**Requirements:**
105+
- CMake ≥ 3.20
106+
- Rust/Cargo (latest stable)
107+
- Platform: Windows, macOS, or Linux
108+
109+
## Examples
110+
111+
- [SimpleRoom](https://github.com/livekit/client-sdk-cpp/tree/main/examples/simple_room) - Basic room connection with audio/video
112+
- [SimpleRpc](https://github.com/livekit/client-sdk-cpp/tree/main/examples/simple_rpc) - Remote procedure calls between participants
113+
- [SimpleDataStream](https://github.com/livekit/client-sdk-cpp/tree/main/examples/simple_data_stream) - Send text and binary data streams
114+
115+
## Resources
10116
11117
- [GitHub Repository](https://github.com/livekit/client-sdk-cpp)
12-
- [Examples](https://github.com/livekit/client-sdk-cpp/tree/main/examples)
13-
- [Introduction to LiveKit](https://docs.livekit.io/home/get-started/intro-to-livekit/)
118+
- [LiveKit Documentation](https://docs.livekit.io/)
14119
- [Community Slack](https://livekit.io/join-slack)

0 commit comments

Comments
 (0)