1#ifndef MILLICAST_API_VIEWER_H
2#define MILLICAST_API_VIEWER_H
25struct ViewerOption :
public ClientOption {
33 std::optional<std::string>
36 std::optional<uint8_t>
37 multiplexed_audio_track;
40 std::vector<std::string>
51 struct ForcePlayoutDelay {
59 std::optional<ForcePlayoutDelay> force_playout_delay;
64 std::optional<unsigned int> maximum_bitrate;
71 int jitter_minimum_delay_ms =
88 bool force_smooth{
false};
97 std::optional<unsigned int> bwe_monitor_duration_us;
103 std::optional<unsigned int> upwards_layer_wait_time_ms;
113 std::optional<double> bwe_rate_change_percentage;
118 enum class AbrStrategy {
129 AbrStrategy abr_strategy{AbrStrategy::DEFAULT};
137struct ViewerCredentials {
141 std::string stream_name;
143 std::optional<std::string> token;
144 std::string account_id;
156 using Option = ViewerOption;
157 using Credentials = ViewerCredentials;
163 struct StreamStopped {
164 std::string description;
176 virtual Promise<void> subscribe(
177 std::optional<ViewerOption>&& options = std::nullopt) = 0;
183 virtual Promise<void> unsubscribe() = 0;
190 [[nodiscard]]
virtual Promise<bool> is_subscribed()
const = 0;
197 virtual Promise<void> set_credentials(ViewerCredentials&& creds) = 0;
203 [[nodiscard]]
virtual Promise<ViewerCredentials> get_credentials()
const = 0;
209 static std::unique_ptr<Viewer> create();
214 struct RtsTrackAdded {
215 RtsRemoteTrack& track;
219 struct RtsStatsEvent {
220 const std::shared_ptr<const RtsViewerStats> viewer_stats;
228 virtual EventConnectionPtr add_event_handler(
229 EventHandler<RtsTrackAdded>&& handler) = 0;
236 virtual EventConnectionPtr add_event_handler(
237 EventHandler<StreamStopped>&& handler) = 0;
248 "Use the overload with RtsStatsEvent")]]
virtual EventConnectionPtr
249 add_event_handler(EventHandler<StatsEvent>&& handler) = 0;
259 virtual EventConnectionPtr add_event_handler(
260 EventHandler<RtsStatsEvent>&& handler) = 0;
268 virtual EventConnectionPtr add_event_handler(
269 EventHandler<ViewerCount>&& handler) = 0;
276 virtual EventConnectionPtr add_event_handler(
277 EventHandler<SignalingError>&& handler) = 0;
284 virtual EventConnectionPtr add_event_handler(
285 EventHandler<HttpConnectionError>&& handler) = 0;
292 virtual EventConnectionPtr add_event_handler(
293 EventHandler<WebsocketState>&& handler) = 0;
301 virtual EventConnectionPtr add_event_handler(
302 EventHandler<PeerConnectionState>&& handler) = 0;
311 [[nodiscard]]
virtual Promise<std::vector<RtsRemoteAudioTrack*>>
312 audio_tracks()
const = 0;
321 [[nodiscard]]
virtual Promise<std::vector<RtsRemoteVideoTrack*>>
322 video_tracks()
const = 0;
344 virtual Promise<WebrtcRemoteTrack*> add_webrtc_remote_track(
345 WebrtcRemoteTrack::Kind kind,
346 std::string_view cname) = 0;
356 [[nodiscard]]
virtual Promise<std::vector<WebrtcRemoteAudioTrack*>>
357 webrtc_audio_tracks()
const = 0;
367 [[nodiscard]]
virtual Promise<std::vector<WebrtcRemoteVideoTrack*>>
368 webrtc_video_tracks()
const = 0;
432 virtual void enable_seamless_migration(
bool enabled =
true) = 0;
#define MILLICAST_API
Definition exports.h:51