PrivMX Endpoint v2.7.0
Loading...
Searching...
No Matches
privmx::endpoint::stream::StreamApi Class Reference

#include <stream/webrtc/include_pub/privmx/endpoint/stream/StreamApi.hpp>

Public Member Functions

 StreamApi ()=default
std::string createStreamRoom (const std::string &contextId, const std::vector< core::UserWithPubKey > &users, const std::vector< core::UserWithPubKey > &managers, const core::Buffer &publicMeta, const core::Buffer &privateMeta, const std::optional< core::ContainerPolicy > &policies)
void updateStreamRoom (const std::string &streamRoomId, const std::vector< core::UserWithPubKey > &users, const std::vector< core::UserWithPubKey > &managers, const core::Buffer &publicMeta, const core::Buffer &privateMeta, const int64_t version, const bool force, const bool forceGenerateNewKey, const std::optional< core::ContainerPolicy > &policies)
core::PagingList< StreamRoomlistStreamRooms (const std::string &contextId, const core::PagingQuery &query)
StreamRoom getStreamRoom (const std::string &streamRoomId)
void deleteStreamRoom (const std::string &streamRoomId)
std::vector< std::string > subscribeFor (const std::vector< std::string > &subscriptionQueries)
void unsubscribeFrom (const std::vector< std::string > &subscriptionIds)
std::string buildSubscriptionQuery (EventType eventType, EventSelectorType selectorType, const std::string &selectorId)
std::vector< StreamInfolistStreams (const std::string &streamRoomId)
void joinStreamRoom (const std::string &streamRoomId)
void leaveStreamRoom (const std::string &streamRoomId)
void enableStreamRoomRecording (const std::string &streamRoomId)
std::vector< stream::RecordingEncKeygetStreamRoomRecordingKeys (const std::string &streamRoomId)
StreamHandle createStream (const std::string &streamRoomId)
std::vector< AudioDevicegetAudioDevices ()
std::vector< VideoDevicegetVideoDevices ()
std::vector< DesktopDevicegetDesktopDevices (DesktopType desktopType)
MediaTrack addTrack (const StreamHandle &streamHandle, const MediaDevice &track, const MediaTrackConstrains &mediaTrackConstrains)
void removeTrack (const StreamHandle &streamHandle, const MediaDevice &track)
StreamPublishResult publishStream (const StreamHandle &streamHandle)
StreamPublishResult updateStream (const StreamHandle &streamHandle)
void unpublishStream (const StreamHandle &streamHandle)
void subscribeToRemoteStreams (const std::string &streamRoomId, const std::vector< StreamSubscription > &subscriptions)
void modifyRemoteStreamsSubscriptions (const std::string &streamRoomId, const std::vector< StreamSubscription > &subscriptionsToAdd, const std::vector< StreamSubscription > &subscriptionsToRemove)
void unsubscribeFromRemoteStreams (const std::string &streamRoomId, const std::vector< StreamSubscription > &subscriptionsToRemove)
void dropBrokenFrames (const std::string &streamRoomId, bool enable)
void addRemoteStreamListener (const std::string &streamRoomId, std::optional< int64_t > streamId, std::shared_ptr< OnTrackInterface > onTrack)
std::shared_ptr< StreamApiImpl > getImpl () const

Static Public Member Functions

static StreamApi create (core::Connection &connection, event::EventApi &eventApi)

Detailed Description

'StreamApi' is a class representing Endpoint's API for Stream Rooms and WebRTC streams.

Constructor & Destructor Documentation

◆ StreamApi()

privmx::endpoint::stream::StreamApi::StreamApi ( )
default

//doc-gen:ignore

Member Function Documentation

◆ addRemoteStreamListener()

void privmx::endpoint::stream::StreamApi::addRemoteStreamListener ( const std::string & streamRoomId,
std::optional< int64_t > streamId,
std::shared_ptr< OnTrackInterface > onTrack )

Registers a listener for remote tracks in the Stream Room.

Parameters
streamRoomIdID of the Stream Room
streamIdoptional remote stream ID to filter events (std::nullopt for all streams)
onTracklistener implementation

◆ addTrack()

MediaTrack privmx::endpoint::stream::StreamApi::addTrack ( const StreamHandle & streamHandle,
const MediaDevice & track,
const MediaTrackConstrains & mediaTrackConstrains )

Adds a local media track to a Stream handle. The track is staged locally and becomes visible to others after publishStream/updateStream.

Parameters
streamHandlehandle returned by createStream
trackmedia device to capture from
mediaTrackConstrainscapture constraints (resolution/fps)
Returns
MediaTrack helper allowing to enable/disable the track

◆ buildSubscriptionQuery()

std::string privmx::endpoint::stream::StreamApi::buildSubscriptionQuery ( EventType eventType,
EventSelectorType selectorType,
const std::string & selectorId )

Generate subscription Query for the Stream Room events.

Parameters
eventTypetype of event which you listen for
selectorTypescope on which you listen for events
selectorIdID of the selector
Returns
subscription query string

◆ create()

StreamApi privmx::endpoint::stream::StreamApi::create ( core::Connection & connection,
event::EventApi & eventApi )
static

Creates an instance of 'StreamApi'.

Parameters
connectioninstance of 'Connection'
eventApiinstance of 'EventApi'
Returns
StreamApi object

◆ createStream()

StreamHandle privmx::endpoint::stream::StreamApi::createStream ( const std::string & streamRoomId)

Creates a local Stream handle for publishing media in given Stream Room. Call addTrack/removeTrack to prepare tracks and publishStream/updateStream to send changes to the server.

Parameters
streamRoomIdID of the Stream Room to create the stream in
Returns
handle to a local Stream instance

◆ createStreamRoom()

std::string privmx::endpoint::stream::StreamApi::createStreamRoom ( const std::string & contextId,
const std::vector< core::UserWithPubKey > & users,
const std::vector< core::UserWithPubKey > & managers,
const core::Buffer & publicMeta,
const core::Buffer & privateMeta,
const std::optional< core::ContainerPolicy > & policies )

Creates a new Stream Room in given Context.

Parameters
contextIdID of the Context to create the Stream Room in
usersvector of UserWithPubKey structs which indicates who will have access to the created Stream Room
managersvector of UserWithPubKey structs which indicates who will have access (and management rights) to the created Stream Room
publicMetapublic (unencrypted) metadata
privateMetaprivate (encrypted) metadata
policiesStream Room's policies (pass std::nullopt to use defaults)
Returns
created Stream Room ID

◆ deleteStreamRoom()

void privmx::endpoint::stream::StreamApi::deleteStreamRoom ( const std::string & streamRoomId)

Deletes a Stream Room by given Stream Room ID.

Parameters
streamRoomIdID of the Stream Room to delete

◆ dropBrokenFrames()

void privmx::endpoint::stream::StreamApi::dropBrokenFrames ( const std::string & streamRoomId,
bool enable )

Configures whether to drop encrypted frames that cannot be decrypted.

Parameters
streamRoomIdID of the Stream Room
enableif true, broken frames will be dropped

◆ enableStreamRoomRecording()

void privmx::endpoint::stream::StreamApi::enableStreamRoomRecording ( const std::string & streamRoomId)

Enables server-side recording for the Stream Room.

Parameters
streamRoomIdID of the Stream Room

◆ getAudioDevices()

std::vector< AudioDevice > privmx::endpoint::stream::StreamApi::getAudioDevices ( )

Lists available local audio input devices.

Returns
list of audio devices

◆ getDesktopDevices()

std::vector< DesktopDevice > privmx::endpoint::stream::StreamApi::getDesktopDevices ( DesktopType desktopType)

Lists available desktop capture sources.

Parameters
desktopTypetype of desktop source (screen/window)
Returns
list of desktop devices

◆ getImpl()

std::shared_ptr< StreamApiImpl > privmx::endpoint::stream::StreamApi::getImpl ( ) const
inline

//doc-gen:ignore

◆ getStreamRoom()

StreamRoom privmx::endpoint::stream::StreamApi::getStreamRoom ( const std::string & streamRoomId)

Gets a single Stream Room by given Stream Room ID.

Parameters
streamRoomIdID of the Stream Room to get
Returns
struct containing information about the Stream Room

◆ getStreamRoomRecordingKeys()

std::vector< stream::RecordingEncKey > privmx::endpoint::stream::StreamApi::getStreamRoomRecordingKeys ( const std::string & streamRoomId)

Gets encryption keys used for Stream Room recordings.

Parameters
streamRoomIdID of the Stream Room
Returns
list of recording encryption keys

◆ getVideoDevices()

std::vector< VideoDevice > privmx::endpoint::stream::StreamApi::getVideoDevices ( )

Lists available local video input devices (cameras).

Returns
list of video devices

◆ joinStreamRoom()

void privmx::endpoint::stream::StreamApi::joinStreamRoom ( const std::string & streamRoomId)

Joins a Stream Room. This is required before calling createStream/publishStream and subscribing to remote streams in the room.

Parameters
streamRoomIdID of the Stream Room to join

◆ leaveStreamRoom()

void privmx::endpoint::stream::StreamApi::leaveStreamRoom ( const std::string & streamRoomId)

Leaves a Stream Room.

Parameters
streamRoomIdID of the Stream Room to leave

◆ listStreamRooms()

core::PagingList< StreamRoom > privmx::endpoint::stream::StreamApi::listStreamRooms ( const std::string & contextId,
const core::PagingQuery & query )

Gets a list of Stream Rooms in given Context.

Parameters
contextIdID of the Context to get the Stream Rooms from
querystruct with list query parameters
Returns
struct containing list of Stream Rooms

◆ listStreams()

std::vector< StreamInfo > privmx::endpoint::stream::StreamApi::listStreams ( const std::string & streamRoomId)

Gets a list of currently published streams in given Stream Room.

Parameters
streamRoomIdID of the Stream Room to list streams from
Returns
list of StreamInfo structs describing currently published streams

◆ modifyRemoteStreamsSubscriptions()

void privmx::endpoint::stream::StreamApi::modifyRemoteStreamsSubscriptions ( const std::string & streamRoomId,
const std::vector< StreamSubscription > & subscriptionsToAdd,
const std::vector< StreamSubscription > & subscriptionsToRemove )

Modifies current remote streams subscriptions.

Parameters
streamRoomIdID of the Stream Room
subscriptionsToAddlist of subscriptions to add
subscriptionsToRemovelist of subscriptions to remove

◆ publishStream()

StreamPublishResult privmx::endpoint::stream::StreamApi::publishStream ( const StreamHandle & streamHandle)

Publishes the Stream (with currently staged tracks) to the server.

Parameters
streamHandlehandle returned by createStream
Returns
result of the publish operation

◆ removeTrack()

void privmx::endpoint::stream::StreamApi::removeTrack ( const StreamHandle & streamHandle,
const MediaDevice & track )

Removes a previously added media track from a Stream handle. For already published streams the removal is applied on updateStream.

Parameters
streamHandlehandle returned by createStream
trackmedia device previously passed to addTrack

◆ subscribeFor()

std::vector< std::string > privmx::endpoint::stream::StreamApi::subscribeFor ( const std::vector< std::string > & subscriptionQueries)

Subscribe for the Stream Room events on the given subscription query.

Parameters
subscriptionQuerieslist of queries
Returns
list of subscriptionIds in maching order to subscriptionQueries

◆ subscribeToRemoteStreams()

void privmx::endpoint::stream::StreamApi::subscribeToRemoteStreams ( const std::string & streamRoomId,
const std::vector< StreamSubscription > & subscriptions )

Subscribes to selected remote streams (and optionally specific tracks) in the Stream Room.

Parameters
streamRoomIdID of the Stream Room
subscriptionslist of remote streams/tracks to subscribe to

◆ unpublishStream()

void privmx::endpoint::stream::StreamApi::unpublishStream ( const StreamHandle & streamHandle)

Stops publishing the Stream.

Parameters
streamHandlehandle returned by createStream

◆ unsubscribeFrom()

void privmx::endpoint::stream::StreamApi::unsubscribeFrom ( const std::vector< std::string > & subscriptionIds)

Unsubscribe from events for the given subscriptionId.

Parameters
subscriptionIdslist of subscriptionId

◆ unsubscribeFromRemoteStreams()

void privmx::endpoint::stream::StreamApi::unsubscribeFromRemoteStreams ( const std::string & streamRoomId,
const std::vector< StreamSubscription > & subscriptionsToRemove )

Unsubscribes from selected remote streams (and optionally specific tracks) in the Stream Room.

Parameters
streamRoomIdID of the Stream Room
subscriptionsToRemovelist of subscriptions to remove

◆ updateStream()

StreamPublishResult privmx::endpoint::stream::StreamApi::updateStream ( const StreamHandle & streamHandle)

Updates a published Stream after adding/removing tracks.

Parameters
streamHandlehandle returned by createStream
Returns
result of the update operation

◆ updateStreamRoom()

void privmx::endpoint::stream::StreamApi::updateStreamRoom ( const std::string & streamRoomId,
const std::vector< core::UserWithPubKey > & users,
const std::vector< core::UserWithPubKey > & managers,
const core::Buffer & publicMeta,
const core::Buffer & privateMeta,
const int64_t version,
const bool force,
const bool forceGenerateNewKey,
const std::optional< core::ContainerPolicy > & policies )

Updates an existing Stream Room.

Parameters
streamRoomIdID of the Stream Room to update
usersvector of UserWithPubKey structs which indicates who will have access to the Stream Room
managersvector of UserWithPubKey structs which indicates who will have access (and management rights) to the Stream Room
publicMetapublic (unencrypted) metadata
privateMetaprivate (encrypted) metadata
versioncurrent version of the updated Stream Room
forceforce update (without checking version)
forceGenerateNewKeyforce to regenerate a key for the Stream Room
policiesStream Room's policies (pass std::nullopt to keep current/defaults)

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