MillicastSDK 1.8.4
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | List of all members
millicast::compat::Viewer Class Referenceabstract

The Viewer class. Its purpose is to receive media by subscribing to a millicast stream. The stream must already exists and someone must publish media. More...

#include <viewer.h>

Inheritance diagram for millicast::compat::Viewer:
Inheritance graph
[legend]
Collaboration diagram for millicast::compat::Viewer:
Collaboration graph
[legend]

Public Types

using Option = ViewerOption
 
using Credentials = ViewerCredentials
 
using LayerData = ViewerLayerData
 
using ProjectionData = ViewerProjectionData
 
using Listener = ViewerListener
 
- Public Types inherited from millicast::ClientBase
using Listener = ClientListener
 
using ConnectionOptions = ClientConnectionOptions
 
using Option = ClientOption
 
using JsonData = ClientJsonData
 

Public Member Functions

virtual bool subscribe (const std::optional< Viewer::Option > &options=std::nullopt)=0
 Subscribe to a Millicast stream. You must be connected first in order to subscribe to a stream.
 
virtual bool unsubscribe ()=0
 Stop receiving media from Millicast. The SDK will automatically disconnect after unsubscribe.
 
virtual bool is_subscribed () const =0
 Tell whether the viewer is subscribed or not.
 
virtual bool project (const std::string &source_id, const std::vector< ProjectionData > &pdata)=0
 Send a command to the media server to forward a media into a specific transceiver.
 
virtual bool unproject (const std::vector< std::string > &mids)=0
 Send a command to stop the projection of a source.
 
virtual bool select (std::optional< LayerData > layer)=0
 Send a command to select a simulcast layer (if simulcast is enabled).
 
virtual bool add_remote_track (std::string_view kind)=0
 Dynamically add another track to the peerconnection adn renegociate SDP locally When the track is created, the listener's method on track will be called.
 
virtual bool set_credentials (const Credentials &creds)=0
 Set the viewer credentials.
 
virtual bool set_credentials (Credentials &&creds)=0
 
virtual Credentials get_credentials () const =0
 Get the current viewer credentials.
 
virtual void set_listener (Viewer::Listener *listener)=0
 set_listener : set the viewer listener to receive event from the viewer.
 
- Public Member Functions inherited from millicast::compat::Client
virtual bool connect (const std::optional< ConnectionOptions > &connection_options=std::nullopt)=0
 Connect and open a websocket connection with the Millicast platform.
 
virtual bool connect (const JsonData &data, const std::optional< ConnectionOptions > &connection_options=std::nullopt)=0
 Connect to the media server directly using the websocket url and the JWT.
 
virtual bool is_connected () const =0
 is_connected
 
virtual bool disconnect ()=0
 Disconnect from Millicast. The websocket connection to Millicast will no longer be active after disconnect is complete. If the client is currently publishing/subscribing, the SDK will first stop the publishing/subscribing before disconnecting.
 
virtual void enable_stats (bool enable)=0
 Enable the rtc stats collecting. The stats are collected once the client is either publishing or subscribed.
 
virtual std::optional< std::string > get_mid (const std::string &track_id)=0
 Get the transceiver mid associated to a track if any.
 
virtual void enable_frame_transformer (bool enable)=0
 Add frame transformer so you can add metadata to frame When a new transformable frame is available, the listener method on_transformable_frame will be called.
 
- Public Member Functions inherited from millicast::ClientBase
virtual ~ClientBase ()=default
 

Static Public Member Functions

static std::unique_ptr< Viewercreate ()
 Create a new viewer.
 
- Static Public Member Functions inherited from millicast::ClientBase
static std::list< std::string > get_supported_video_codecs ()
 get_supported_video_codecs returns the list of the supported video codecs.
 
static std::list< std::string > get_supported_audio_codecs ()
 get_supported_audio_codecs returns the list of the supported audio codecs.
 
static void cleanup ()
 Clean and free the memory of dynamic objects.
 

Detailed Description

The Viewer class. Its purpose is to receive media by subscribing to a millicast stream. The stream must already exists and someone must publish media.

Member Typedef Documentation

◆ Credentials

◆ LayerData

◆ Listener

◆ Option

◆ ProjectionData

Member Function Documentation

◆ add_remote_track()

virtual bool millicast::compat::Viewer::add_remote_track ( std::string_view  kind)
pure virtual

Dynamically add another track to the peerconnection adn renegociate SDP locally When the track is created, the listener's method on track will be called.

Parameters
kindWhether it is a video or audio track. Accepted value are "video" or "audio".
Returns
true if success. False otherwise.

◆ create()

static std::unique_ptr< Viewer > millicast::compat::Viewer::create ( )
static

Create a new viewer.

Returns
A new Viewer object.

◆ get_credentials()

virtual Credentials millicast::compat::Viewer::get_credentials ( ) const
pure virtual

Get the current viewer credentials.

Returns
The current credentials set in the viewer.

◆ is_subscribed()

virtual bool millicast::compat::Viewer::is_subscribed ( ) const
pure virtual

Tell whether the viewer is subscribed or not.

Returns
true if the viewer if subscribed, false otherwise.

◆ project()

virtual bool millicast::compat::Viewer::project ( const std::string &  source_id,
const std::vector< ProjectionData > &  pdata 
)
pure virtual

Send a command to the media server to forward a media into a specific transceiver.

Parameters
source_idThe id of the source publishing media (see multisource).
pdataThe projection data to send to the server.
Returns
true if success false otherwise

◆ select()

virtual bool millicast::compat::Viewer::select ( std::optional< LayerData layer)
pure virtual

Send a command to select a simulcast layer (if simulcast is enabled).

Parameters
layerThe layer to select. Leave the optional empty if you want to let the server choose automatically the layer.
Returns
true if success false otherwise.

◆ set_credentials() [1/2]

virtual bool millicast::compat::Viewer::set_credentials ( const Credentials creds)
pure virtual

Set the viewer credentials.

Parameters
credsThe credentials
Returns
true if the credentials are valid and set correctly, false otherwise.

◆ set_credentials() [2/2]

virtual bool millicast::compat::Viewer::set_credentials ( Credentials &&  creds)
pure virtual

◆ set_listener()

virtual void millicast::compat::Viewer::set_listener ( Viewer::Listener listener)
pure virtual

set_listener : set the viewer listener to receive event from the viewer.

Parameters
listenerThe Viewer listener

◆ subscribe()

virtual bool millicast::compat::Viewer::subscribe ( const std::optional< Viewer::Option > &  options = std::nullopt)
pure virtual

Subscribe to a Millicast stream. You must be connected first in order to subscribe to a stream.

Parameters
optionssubscribing options (optional)
Returns
true if viewing options are valid, false otherwise.
Remarks
After trying,a successful subscribe results in the Listener's method on_subscribed being called.

◆ unproject()

virtual bool millicast::compat::Viewer::unproject ( const std::vector< std::string > &  mids)
pure virtual

Send a command to stop the projection of a source.

Parameters
midsThe transceivers mids to stop projecting.
Returns
true if success false otherwise

◆ unsubscribe()

virtual bool millicast::compat::Viewer::unsubscribe ( )
pure virtual

Stop receiving media from Millicast. The SDK will automatically disconnect after unsubscribe.

Returns
false if unable to reach a disconnected state, true otherwise.

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