Skip to content

Commit 49d6535

Browse files
authored
Update README.md
1 parent 6aa0d75 commit 49d6535

File tree

1 file changed

+241
-2
lines changed

1 file changed

+241
-2
lines changed

README.md

Lines changed: 241 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,241 @@
1-
# rtms-sdk-cpp
2-
The C++ SDK for Realtime Media Streams also known as librtmsdk
1+
# RTMS SDK for C++
2+
3+
The RTMS (Real-Time Media Streaming) C++ SDK enables third-party app servers to connect to the RTMS gateway and retrieve video, audio, and transcript data from Zoom meetings in real-time.
4+
5+
## Supported Platforms
6+
7+
- Linux
8+
- macOS
9+
10+
## Installation
11+
12+
### Linux
13+
14+
The SDK package for Linux is provided as a dynamic library (`.so` file).
15+
16+
**Contents:**
17+
- Header files:
18+
- `rtms_common.h`
19+
- `rtms_sdk.h` (include this in your C++ source or header files)
20+
- `rtms_csdk.h` (for C interface - ignore when using C++ API)
21+
- Library file: `librtmsdk.so.0`
22+
23+
### macOS
24+
25+
The SDK package for macOS is provided as a dylib file.
26+
27+
**Contents:**
28+
- Header files:
29+
- `rtms_common.h`
30+
- `rtms_sdk.h` (include this in your C++ source or header files)
31+
- `rtms_csdk.h` (for C interface - ignore when using C++ API)
32+
- Library files:
33+
- `tp.framework`
34+
- `util.framework`
35+
- `libzContext.dylib`
36+
- `libssl.dylib`
37+
- `librtms_sdk.dylib`
38+
- `libjson.dylib`
39+
- `libcrypto.dylib`
40+
- `curl64.framework`
41+
42+
## Features
43+
44+
The SDK provides access to the following data types from Zoom meetings:
45+
46+
- **Participant information** - Details about meeting participants
47+
- **RTMS session information** - Session metadata and status
48+
- **Audio data** - Real-time audio streams
49+
- **Video data** - Real-time video streams
50+
- **Desktop share data** - Screen sharing content
51+
- **Transcript data** - Live meeting transcription
52+
- **Chat data** - Meeting chat messages
53+
54+
## Usage
55+
56+
### 1. Create a Sink Object
57+
58+
Inherit from `rtms_sdk_sink` and implement the virtual callback functions:
59+
60+
```cpp
61+
class sample_sink : public rtms_sdk_sink
62+
{
63+
public:
64+
sample_sink() {}
65+
~sample_sink() {}
66+
67+
virtual void on_join_confirm(int reason);
68+
virtual void on_session_update(int op, struct session_info *sess);
69+
virtual void on_user_update(int op, struct participant_info *pi);
70+
virtual void on_audio_data(unsigned char *data_buf, int size, uint64_t timestamp, struct rtms_metadata *md);
71+
virtual void on_video_data(unsigned char *data_buf, int size, uint64_t timestamp, struct rtms_metadata *md);
72+
virtual void on_ds_data(unsigned char *data_buf, int size, uint64_t timestamp, struct rtms_metadata *md);
73+
virtual void on_transcript_data(unsigned char *data_buf, int size, uint64_t timestamp, struct rtms_metadata *md);
74+
virtual void on_leave(int reason);
75+
};
76+
```
77+
78+
### 2. Initialize the SDK Provider
79+
80+
Initialize the `rtms_sdk_provider` singleton with a Certificate Authority (CA) file:
81+
82+
```cpp
83+
rtms_sdk_provider::instance()->init("./cert/ca.crt");
84+
```
85+
86+
### 3. Create and Configure SDK Instance
87+
88+
```cpp
89+
// Create sink instance
90+
sample_sink *_sink = new sample_sink;
91+
92+
// Create SDK instance
93+
rtms_sdk *sdk = rtms_sdk_provider::instance()->create_sdk();
94+
95+
// Configure SDK
96+
sdk->config(NULL, SDK_ALL, 0);
97+
```
98+
99+
**Media Type Options:**
100+
- `SDK_ALL` - All supported media types
101+
- `SDK_AUDIO` - Audio only
102+
- `SDK_VIDEO` - Video only
103+
- `SDK_DESKSHARE` - Desktop sharing only
104+
- `SDK_TRANSCRIPT` - Transcript only
105+
- `SDK_CHAT` - Chat only
106+
107+
### 4. Join Meeting Session
108+
109+
```cpp
110+
sdk->open(_sink);
111+
sdk->join(<meeting_uuid>, <rtms_stream_id>, <signature>, <server_url>, 10000);
112+
```
113+
114+
**Parameters:**
115+
- `meeting_uuid` - Zoom meeting UUID (provided via webhook)
116+
- `rtms_stream_id` - RTMS stream identity (provided via webhook)
117+
- `signature` - HMACSHA256(client_id + "," + meeting_uuid + "," + rtms_stream_id, secret)
118+
- `server_url` - RTMS gateway URL (provided via webhook)
119+
- `timeout` - Join timeout in milliseconds
120+
121+
### 5. Main Loop
122+
123+
Keep the client running to receive media data continuously:
124+
125+
```cpp
126+
while (running) {
127+
sdk->poll();
128+
}
129+
```
130+
131+
### 6. Cleanup
132+
133+
Release resources when done:
134+
135+
```cpp
136+
rtms_sdk_provider::instance()->release_sdk(sdk);
137+
```
138+
139+
## Complete Example
140+
141+
```cpp
142+
#include "string.h"
143+
#include "rtms_sdk.h"
144+
145+
bool s_is_running = true;
146+
147+
class sample_sink : public rtms_sdk_sink
148+
{
149+
public:
150+
sample_sink() {}
151+
~sample_sink() {}
152+
153+
virtual void on_join_confirm(int reason) {
154+
printf("on_join_confirm, reason: %d\n", reason);
155+
}
156+
157+
virtual void on_session_update(int op, struct session_info *sess) {
158+
printf("on_session_update\n");
159+
}
160+
161+
virtual void on_user_update(int op, struct participant_info *pi) {
162+
printf("on_user_update\n");
163+
}
164+
165+
virtual void on_audio_data(unsigned char *data_buf, int size, uint64_t timestamp, struct rtms_metadata *md) {
166+
printf("on_audio_data, timestamp:%lu\n", timestamp);
167+
}
168+
169+
virtual void on_video_data(unsigned char *data_buf, int size, uint64_t timestamp, struct rtms_metadata *md) {
170+
// Handle video data
171+
}
172+
173+
virtual void on_ds_data(unsigned char *data_buf, int size, uint64_t timestamp, struct rtms_metadata *md) {
174+
// Handle desktop share data
175+
}
176+
177+
virtual void on_transcript_data(unsigned char *data_buf, int size, uint64_t timestamp, struct rtms_metadata *md) {
178+
printf("[%s]: %s\n", md->user_name, data_buf);
179+
}
180+
181+
virtual void on_leave(int reason) {
182+
printf("on_leave\n");
183+
s_is_running = false;
184+
}
185+
};
186+
187+
int main(int argc, char **argv)
188+
{
189+
if (argc < 5) {
190+
printf("Usage: %s <meeting_uuid> <rtms_stream_id> <signature> <signal_url>\n", argv[0]);
191+
return -1;
192+
}
193+
194+
std::string g_meeting_uuid = argv[1];
195+
std::string g_rtms_stream_id = argv[2];
196+
std::string g_signature = argv[3];
197+
std::string g_signal_url = argv[4];
198+
199+
// Initialize SDK provider
200+
rtms_sdk_provider::instance()->init("./cert/ca.crt");
201+
202+
// Create sink and SDK instances
203+
sample_sink *_sink = new sample_sink;
204+
rtms_sdk *sdk = rtms_sdk_provider::instance()->create_sdk();
205+
206+
// Configure for all media types
207+
sdk->config(NULL, SDK_ALL, 0);
208+
209+
// Open connection and join meeting
210+
sdk->open(_sink);
211+
sdk->join(g_meeting_uuid.c_str(), g_rtms_stream_id.c_str(),
212+
g_signature.c_str(), g_signal_url.c_str(), 10000);
213+
214+
// Main loop
215+
while (s_is_running) {
216+
sdk->poll();
217+
}
218+
219+
// Cleanup
220+
rtms_sdk_provider::instance()->release_sdk(sdk);
221+
return 0;
222+
}
223+
```
224+
225+
## Building Your Application
226+
227+
When building your RTMS-enabled client, make sure to:
228+
229+
1. Include the header files in your source code
230+
2. Link against the provided libraries
231+
3. Ensure the CA certificate file is accessible at runtime
232+
233+
## Requirements
234+
235+
- C++11 or later
236+
- Certificate Authority file for TLS verification
237+
- Valid Zoom meeting credentials and webhook parameters
238+
239+
## Support
240+
241+
For questions and support, please refer to the Zoom Developer Documentation or contact Zoom Developer Support.

0 commit comments

Comments
 (0)