MillicastSDK 1.8.4
Loading...
Searching...
No Matches
Public Member Functions | List of all members
millicast::ViewerListener Struct Referenceabstract

The Listener struct for the Viewer class. It adds the on_subscribed event on top of the Client listener You must inherit this class and set a listener with set_listener to be able to receive events from the Viewer. More...

#include <viewer.h>

Inheritance diagram for millicast::ViewerListener:
Inheritance graph
[legend]
Collaboration diagram for millicast::ViewerListener:
Collaboration graph
[legend]

Public Member Functions

virtual void on_subscribed ()=0
 on_subscribed is called when the subcription to the stream is complete.
 
virtual void on_subscribed_error (const std::string &error)=0
 Called when an error occured while establishing the peerconnection.
 
virtual void on_track (std::weak_ptr< VideoTrack > track, const std::optional< std::string > &mid)=0
 on_track is called when a remote video track has been added.
 
virtual void on_track (std::weak_ptr< AudioTrack > track, const std::optional< std::string > &mid)=0
 on_track is called when a remote audio track has been added.
 
virtual void on_active (const std::string &stream_id, const std::vector< TrackInfo > &tracks, const std::optional< std::string > &source_id)=0
 Called when a new source has been publishing within the new stream.
 
virtual void on_inactive (const std::string &stream_id, const std::optional< std::string > &source_id)=0
 Called when a source has been unpublished within the stream.
 
virtual void on_stopped ()=0
 onStopped callback is not currently used, but is reserved for future usage.
 
virtual void on_vad (const std::string &mid, const std::optional< std::string > &source_id)=0
 Called when a source id is being multiplexed into the audio track based on the voice activity level.
 
virtual void on_layers (const std::string &mid, const std::vector< ViewerLayerData > &active_layers, const std::vector< std::string > &inactive_layers)=0
 Called when simulcast/svc layers are available.
 
virtual void on_frame_metadata (uint32_t ssrc, uint32_t timestamp, const std::vector< uint8_t > &data)
 Called when a frame is received and not yet decoded Extract metadata embedded in the frame if any.
 
- Public Member Functions inherited from millicast::ClientListener
virtual void on_connected ()=0
 on_connected is called when the WebSocket connection to Millicast is opened
 
virtual void on_disconnected ()=0
 on_disconnected is called when the WebSocket connection to Millicast is closed. If this was an unintended disconnect, a reconnect attempt will happen automatically by default. To turn off the automatic reconnect, set {Option::auto_reconnect} to false.
 
virtual void on_connection_error (int status, const std::string &reason)=0
 on_connection_error is called when the attempt to connect to Millicast failed.
 
virtual void on_signaling_error (const std::string &message)=0
 Called when millicast sends back an error message in response to a websocket command.
 
virtual void on_stats_report (std::unique_ptr< StatsReport >)
 on_stats_report is called when a new rtc stats report has been collected.
 
virtual void on_viewer_count (int count)=0
 Called when a new viewer join the stream or when a viewer quit the stream.
 
virtual ~ClientListener ()=default
 

Detailed Description

The Listener struct for the Viewer class. It adds the on_subscribed event on top of the Client listener You must inherit this class and set a listener with set_listener to be able to receive events from the Viewer.

Member Function Documentation

◆ on_active()

virtual void millicast::ViewerListener::on_active ( const std::string &  stream_id,
const std::vector< TrackInfo > &  tracks,
const std::optional< std::string > &  source_id 
)
pure virtual

Called when a new source has been publishing within the new stream.

Parameters
streamIdThe stream id.
tracksAll the track ids within the stream
sourceIdThe source id if the publisher has set one.

◆ on_frame_metadata()

virtual void millicast::ViewerListener::on_frame_metadata ( uint32_t  ssrc,
uint32_t  timestamp,
const std::vector< uint8_t > &  data 
)
inlinevirtual

Called when a frame is received and not yet decoded Extract metadata embedded in the frame if any.

Parameters
ssrcSynchronization source of the frame
timestampTimestamp of the frame
datavector filled with user data coming from the publisher.

◆ on_inactive()

virtual void millicast::ViewerListener::on_inactive ( const std::string &  stream_id,
const std::optional< std::string > &  source_id 
)
pure virtual

Called when a source has been unpublished within the stream.

Parameters
streamIdThe stream id.
sourceIdThe source id set by the publisher if any.

◆ on_layers()

virtual void millicast::ViewerListener::on_layers ( const std::string &  mid,
const std::vector< ViewerLayerData > &  active_layers,
const std::vector< std::string > &  inactive_layers 
)
pure virtual

Called when simulcast/svc layers are available.

Parameters
midThe mid associated to the track
activeLayersActive simulcast/SVC layers
inactiveLayersencoding IDs of inactive simulcast/SVC layers

◆ on_stopped()

virtual void millicast::ViewerListener::on_stopped ( )
pure virtual

onStopped callback is not currently used, but is reserved for future usage.

◆ on_subscribed()

virtual void millicast::ViewerListener::on_subscribed ( )
pure virtual

on_subscribed is called when the subcription to the stream is complete.

◆ on_subscribed_error()

virtual void millicast::ViewerListener::on_subscribed_error ( const std::string &  error)
pure virtual

Called when an error occured while establishing the peerconnection.

Parameters
reasonThe reason of the error

◆ on_track() [1/2]

virtual void millicast::ViewerListener::on_track ( std::weak_ptr< AudioTrack track,
const std::optional< std::string > &  mid 
)
pure virtual

on_track is called when a remote audio track has been added.

Parameters
trackThe remote audio track.
midThe associated transceiver mid if any

◆ on_track() [2/2]

virtual void millicast::ViewerListener::on_track ( std::weak_ptr< VideoTrack track,
const std::optional< std::string > &  mid 
)
pure virtual

on_track is called when a remote video track has been added.

Parameters
trackThe remote video track.
midThe associated transceiver midif any

◆ on_vad()

virtual void millicast::ViewerListener::on_vad ( const std::string &  mid,
const std::optional< std::string > &  source_id 
)
pure virtual

Called when a source id is being multiplexed into the audio track based on the voice activity level.

Parameters
midThe media id.
sourceIdThe source id.

The documentation for this struct was generated from the following file: