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;
121struct ViewerCredentials {
125 std::string stream_name;
127 std::optional<std::string> token;
128 std::string account_id;
140 using Option = ViewerOption;
141 using Credentials = ViewerCredentials;
147 struct StreamStopped {
148 std::string description;
160 virtual Promise<void> subscribe(
161 std::optional<ViewerOption>&& options = std::nullopt) = 0;
167 virtual Promise<void> unsubscribe() = 0;
174 [[nodiscard]]
virtual Promise<bool> is_subscribed()
const = 0;
181 virtual Promise<void> set_credentials(ViewerCredentials&& creds) = 0;
187 [[nodiscard]]
virtual Promise<ViewerCredentials> get_credentials()
const = 0;
193 static std::unique_ptr<Viewer> create();
198 struct RtsTrackAdded {
199 RtsRemoteTrack& track;
203 struct RtsStatsEvent {
204 const std::shared_ptr<const RtsViewerStats> viewer_stats;
212 virtual EventConnectionPtr add_event_handler(
213 EventHandler<RtsTrackAdded>&& handler) = 0;
220 virtual EventConnectionPtr add_event_handler(
221 EventHandler<StreamStopped>&& handler) = 0;
232 "Use the overload with RtsStatsEvent")]]
virtual EventConnectionPtr
233 add_event_handler(EventHandler<StatsEvent>&& handler) = 0;
243 virtual EventConnectionPtr add_event_handler(
244 EventHandler<RtsStatsEvent>&& handler) = 0;
252 virtual EventConnectionPtr add_event_handler(
253 EventHandler<ViewerCount>&& handler) = 0;
260 virtual EventConnectionPtr add_event_handler(
261 EventHandler<SignalingError>&& handler) = 0;
268 virtual EventConnectionPtr add_event_handler(
269 EventHandler<HttpConnectionError>&& handler) = 0;
276 virtual EventConnectionPtr add_event_handler(
277 EventHandler<WebsocketState>&& handler) = 0;
285 virtual EventConnectionPtr add_event_handler(
286 EventHandler<PeerConnectionState>&& handler) = 0;
295 [[nodiscard]]
virtual Promise<std::vector<RtsRemoteAudioTrack*>>
296 audio_tracks()
const = 0;
305 [[nodiscard]]
virtual Promise<std::vector<RtsRemoteVideoTrack*>>
306 video_tracks()
const = 0;
328 virtual Promise<WebrtcRemoteTrack*> add_webrtc_remote_track(
329 WebrtcRemoteTrack::Kind kind,
330 std::string_view cname) = 0;
340 [[nodiscard]]
virtual Promise<std::vector<WebrtcRemoteAudioTrack*>>
341 webrtc_audio_tracks()
const = 0;
351 [[nodiscard]]
virtual Promise<std::vector<WebrtcRemoteVideoTrack*>>
352 webrtc_video_tracks()
const = 0;
416 virtual void enable_seamless_migration(
bool enabled =
true) = 0;
#define MILLICAST_API
Definition exports.h:51