MillicastSDK 2.0.0
Loading...
Searching...
No Matches
client.h
Go to the documentation of this file.
1#ifndef MILLICAST_API_CLIENT_H
2#define MILLICAST_API_CLIENT_H
3
11#include <functional>
12#include <list>
13#include <memory>
14#include <optional>
15#include <string>
16#include <vector>
17
23#include "millicast-sdk/stats.h"
24
25namespace millicast {
32 DISABLED,
39};
40
54 bool disable_bwe{true};
55 std::optional<int> min_bitrate_kbps;
56 std::optional<int> max_bitrate_kbps;
57};
58
63struct TrackInfo {
64 std::string media;
65 std::string track_id;
66};
67
78 bool auto_reconnect{true};
79};
80
85 std::optional<bool> stereo;
86 std::optional<bool>
89 int stats_delay_ms{3000};
92 std::optional<DegradationPreferences>
97};
98
104 std::string ws_url;
105 std::string jwt;
106};
107
109 public:
113
114 virtual ~ClientBase() = default;
115
121 static std::list<std::string> get_supported_video_codecs();
122
128 static std::list<std::string> get_supported_audio_codecs();
129
134 static void cleanup();
135};
136
143 public:
149 struct StatsEvent {
153 std::shared_ptr<StatsReport> report{};
154 };
155
160 struct ViewerCount {
164 int viewer_count{0};
165 };
166
175 std::string description;
176 };
177
190 std::string description;
191 };
192
199 enum class ConnectionState {
200 IDLE,
201 CONNECTING,
202 CONNECTED,
203 RECONNECTING,
204 DISCONNECTING,
205 FAILED
206 };
207
216 };
217
226 };
227
237 std::optional<ConnectionOptions>&& connection_options) = 0;
238
249 JsonData&& data,
250 std::optional<ConnectionOptions>&& connection_options) = 0;
251
257 [[nodiscard]] virtual Promise<bool> is_connected() const = 0;
258
268
275 virtual Promise<void> enable_stats(bool enable) = 0;
276};
277
278} // namespace millicast
279
280#endif /* MILLICAST_API_CLIENT_H */
Definition client.h:108
static std::list< std::string > get_supported_video_codecs()
get_supported_video_codecs returns the list of the supported video codecs.
virtual ~ClientBase()=default
static void cleanup()
Clean and free the memory of dynamic objects.
static std::list< std::string > get_supported_audio_codecs()
get_supported_audio_codecs returns the list of the supported audio codecs.
The Client base class.
Definition client.h:142
virtual Promise< void > connect(JsonData &&data, std::optional< ConnectionOptions > &&connection_options)=0
Connect to the media server directly using the websocket url and the JWT.
virtual Promise< void > enable_stats(bool enable)=0
Enable the rtc stats collecting. The stats are collected once the client is either publishing or subs...
virtual Promise< void > connect(std::optional< ConnectionOptions > &&connection_options)=0
Connect and open a websocket connection with the Millicast platform.
virtual Promise< bool > is_connected() const =0
is_connected
ConnectionState
The Connection State enum describes the possible states that a network connecting socket can be in....
Definition client.h:199
virtual Promise< void > disconnect()=0
Disconnect from Millicast. The websocket connection to Millicast will no longer be active after disco...
Definition promise.h:45
#define MILLICAST_API
Definition exports.h:51
Definition capabilities.h:15
DegradationPreferences
The DegradationPreferences enum.
Definition client.h:31
Allows setting the desired minimum and/or maximum bitrates when publishing a stream....
Definition client.h:53
std::optional< int > max_bitrate_kbps
Definition client.h:56
bool disable_bwe
Definition client.h:54
std::optional< int > min_bitrate_kbps
Definition client.h:55
The Http Connection Error event is emitted when there is a problem connecting to the millicast backen...
Definition client.h:182
std::string description
A brief description of the error.
Definition client.h:190
int status_code
The Http status code indicating the error.
Definition client.h:186
This event describes the current state of the Peer Connection.
Definition client.h:221
ConnectionState state
The state of the Peer Connection.
Definition client.h:225
The Signaling Error event is emitted when a message attempted to be sent on the signaling channel is ...
Definition client.h:171
std::string description
Description of the error.
Definition client.h:175
The Stats Event that is emitted by the SDK containing the stats report. The stats provide insight int...
Definition client.h:149
The Viewer Count event emitted by the SDK when the number of viewers for a stream changes.
Definition client.h:160
This event describes the current state of the websocket.
Definition client.h:211
ConnectionState state
The state of the Websocket.
Definition client.h:215
Connection related options.
Definition client.h:71
Authentication data returned by the director api in order to open a websocket connection.
Definition client.h:103
std::string jwt
Definition client.h:105
std::string ws_url
Definition client.h:104
The ClientOption struct allows to setup the millicast connection.
Definition client.h:84
std::optional< bool > stereo
Definition client.h:85
std::optional< bool > dtx
Definition client.h:87
std::optional< DegradationPreferences > degradation
Definition client.h:93
std::string rtc_event_log_output_path
Definition client.h:96
Useful informations about the available tracks in the media server. These informations are received i...
Definition client.h:63
std::string track_id
Definition client.h:65
std::string media
Definition client.h:64