MillicastSDK 2.0.0
|
The Publisher class. Its purpose is to publish media to a Millicast stream. More...
#include <publisher.h>
Classes | |
struct | FirstViewerActive |
struct | LastViewerInactive |
Public Types | |
using | Credentials = PublisherCredentials |
using | Option = PublisherOption |
Public Types inherited from millicast::Client | |
enum class | ConnectionState { IDLE , CONNECTING , CONNECTED , RECONNECTING , DISCONNECTING , FAILED } |
The Connection State enum describes the possible states that a network connecting socket can be in. This enum will be used in the WebsocketState and PeerConnectionState events to describe the state of those network mediums. More... | |
Public Types inherited from millicast::ClientBase | |
using | ConnectionOptions = ClientConnectionOptions |
using | Option = ClientOption |
using | JsonData = ClientJsonData |
Public Member Functions | |
virtual Promise< void > | publish (std::optional< PublisherOption > &&options=std::nullopt)=0 |
Publish a stream to Millicast You must be connected first in order to publish a stream. | |
virtual Promise< void > | unpublish ()=0 |
Stop sending media to Millicast. The SDK will automatically disconnect after unpublish. | |
virtual Promise< bool > | is_publishing () const =0 |
Tell if the publisher is publishing. | |
virtual Promise< void > | set_credentials (PublisherCredentials &&creds)=0 |
Set the publisher credentials. | |
virtual Promise< PublisherCredentials > | get_credentials () const =0 |
Get the current publisher credentials. | |
virtual Promise< void > | add_track (std::weak_ptr< Track > track)=0 |
virtual Promise< void > | add_track (std::weak_ptr< VideoTrack > track)=0 |
virtual Promise< void > | add_track (std::weak_ptr< AudioTrack > track)=0 |
virtual Promise< void > | clear_tracks ()=0 |
virtual Promise< void > | set_frame_metadata_handler (EncodedVideoFrameCallback &&callback)=0 |
Set a callback to receive encoded video frames that you can embed metadata into. | |
virtual Promise< void > | record ()=0 |
Starts recording of the published stream. | |
virtual Promise< void > | unrecord ()=0 |
Stops recording of the published stream. | |
virtual EventConnectionPtr | add_event_handler (EventHandler< FirstViewerActive > &&handler)=0 |
Attach the event handler for when first viewer is active in stream. | |
virtual EventConnectionPtr | add_event_handler (EventHandler< LastViewerInactive > &&handler)=0 |
Attach the event handler for when last viewer has left stream. | |
virtual EventConnectionPtr | add_event_handler (EventHandler< StatsEvent > &&handler)=0 |
Attach the event handler for the StatsEvent containing the StatsReport.. | |
virtual EventConnectionPtr | add_event_handler (EventHandler< ViewerCount > &&handler)=0 |
Attach the event handler for the ViewerCount event emitted when the viewer count has changed. | |
virtual EventConnectionPtr | add_event_handler (EventHandler< SignalingError > &&handler)=0 |
Attach the event handler for the SignalingError event. | |
virtual EventConnectionPtr | add_event_handler (EventHandler< HttpConnectionError > &&handler)=0 |
Attach the event handler for the HttpConnectionError event. | |
virtual EventConnectionPtr | add_event_handler (EventHandler< WebsocketState > &&handler)=0 |
Attach the event handler for the WebsocketState change event. | |
virtual EventConnectionPtr | add_event_handler (EventHandler< PeerConnectionState > &&handler)=0 |
Attach the event handler for the PeerConnectionState change event. | |
Public Member Functions inherited from millicast::Client | |
virtual Promise< void > | connect (std::optional< ConnectionOptions > &&connection_options)=0 |
Connect and open a websocket connection with the Millicast platform. | |
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< bool > | is_connected () const =0 |
is_connected | |
virtual Promise< void > | 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 Promise< void > | enable_stats (bool enable)=0 |
Enable the rtc stats collecting. The stats are collected once the client is either publishing or subscribed. | |
Public Member Functions inherited from millicast::ClientBase | |
virtual | ~ClientBase ()=default |
Static Public Member Functions | |
static std::unique_ptr< Publisher > | create () |
Create a publisher object. | |
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. | |
The Publisher class. Its purpose is to publish media to a Millicast stream.
|
pure virtual |
Attach the event handler for when first viewer is active in stream.
handler | the callback to invoke when first viewer is active. |
|
pure virtual |
Attach the event handler for the HttpConnectionError event.
handler | the callback to invoke when an http error has occured.. |
|
pure virtual |
Attach the event handler for when last viewer has left stream.
handler | the callback to invoke when last viewer has left. |
|
pure virtual |
Attach the event handler for the PeerConnectionState change event.
handler | The callback to invoke when the peer connection state has changed. |
|
pure virtual |
Attach the event handler for the SignalingError event.
handler | the callback to invoke when signaling error has occured.. |
|
pure virtual |
Attach the event handler for the StatsEvent containing the StatsReport..
handler | the callback to invoke when a StatsEvent is ready. |
|
pure virtual |
Attach the event handler for the ViewerCount event emitted when the viewer count has changed.
handler | the callback to invoke publisher has stopped stream. |
|
pure virtual |
Attach the event handler for the WebsocketState change event.
handler | The callback to invoke when the websocket state has changed. |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
static |
Create a publisher object.
|
pure virtual |
Get the current publisher credentials.
|
pure virtual |
Tell if the publisher is publishing.
|
pure virtual |
Publish a stream to Millicast You must be connected first in order to publish a stream.
options | publishing options (optional) |
|
pure virtual |
Starts recording of the published stream.
|
pure virtual |
Set the publisher credentials.
creds | The credentials |
|
pure virtual |
Set a callback to receive encoded video frames that you can embed metadata into.
callback | a function callback that accepts EncodedVideoFrame |
|
pure virtual |
Stop sending media to Millicast. The SDK will automatically disconnect after unpublish.
|
pure virtual |
Stops recording of the published stream.