Documentation

OpenTok
in package

Contains methods for creating OpenTok sessions, generating tokens, and working with archives.

To create a new OpenTok object, call the OpenTok() constructor with your OpenTok API key and the API secret for your OpenTok Video API account. Do not publicly share your API secret. You will use it with the OpenTok() constructor (only on your web server) to create OpenTok sessions.

Be sure to include the entire OpenTok server SDK on your web server.

Table of Contents

connectAudio()  : array<string|int, mixed>
Starts an <a href="https://tokbox.com/developer/guides/audio-connector/">Audio Connector</a> WebSocket connection. to send audio from a Vonage Video API session to a WebSocket.
createSession()  : Session
Creates a new OpenTok session and returns the session ID, which uniquely identifies the session.
deleteArchive()  : bool
Deletes an OpenTok archive.
dial()  : SipCall
Initiates an outgoing SIP call.
disableForceMute()  : bool
Disables the active mute state of the session. After you call this method, new streams published to the session will no longer have audio muted.
forceDisconnect()  : mixed
Disconnects a specific client from an OpenTok session.
forceMuteAll()  : bool
Force all streams (except for an optional list of streams) in an OpenTok session to mute published audio.
forceMuteStream()  : bool
Force the publisher of a specific stream to mute its published audio.
generateToken()  : string
Creates a token for connecting to an OpenTok session.
getArchive()  : Archive
Gets an Archive object for the given archive ID.
getBroadcast()  : Broadcast
Gets information about an OpenTok broadcast.
getRender()  : Render
Fetch an existing render to view status. Status can be one of: <ul> <li><code>starting</code> &mdash; The Vonage Video API platform is in the process of connecting to the remote application at the URL provided. This is the initial state.</li> <li><code>started</code> &mdash; The Vonage Video API platform has succesfully connected to the remote application server, and is republishing that media into the Vonage Video API platform.</li> <li><code>stopped</code> &mdash; The Render has stopped.</li> <li><code>failed</code> &mdash; An error occurred and the Render could not proceed. It may occur at startup if the opentok server cannot connect to the remote application server or republish the stream. It may also occur at point during the rendering process due to some error in the Vonage Video API platform.</li> </ul>
getStream()  : Stream
Gets an Stream object, providing information on a given stream.
listArchives()  : ArchiveList
Returns a list of archives for a session.
listRenders()  : mixed
Returns a list of Experience Composer renderers for an OpenTok project.
listStreams()  : StreamList
Returns a StreamList Object for the given session ID.
playDTMF()  : void
Plays a DTMF string into a session or to a specific connection
setArchiveLayout()  : void
Updates the stream layout in an OpenTok Archive.
setStreamClassLists()  : mixed
Sets the layout class list for streams in a session.
signal()  : mixed
Sends a signal to clients (or a specific client) connected to an OpenTok session.
startArchive()  : Archive
Starts archiving an OpenTok session.
startBroadcast()  : Broadcast
Starts a live streaming broadcast of an OpenTok session.
startRender()  : Render
Starts an Experience Composer renderer for an OpenTok session.
stopArchive()  : Archive
Stops an OpenTok archive that is being recorded.
stopBroadcast()  : mixed
Stops a broadcast.
stopRender()  : mixed
Stops an existing render.
updateBroadcastLayout()  : void
Updates the layout of the broadcast.
updateStream()  : mixed
Sets the layout class list for a stream.

Methods

connectAudio()

Starts an <a href="https://tokbox.com/developer/guides/audio-connector/">Audio Connector</a> WebSocket connection. to send audio from a Vonage Video API session to a WebSocket.

public connectAudio(string $sessionId, string $token, array<string|int, mixed> $websocketOptions) : array<string|int, mixed>
Parameters
$sessionId : string

The session ID.

$token : string

The OpenTok token to be used for the Audio Connector to the OpenTok session. You can add token data to identify that the connection is the Audio Connector endpoint or for other identifying data.

$websocketOptions : array<string|int, mixed>

Configuration for the Websocket. Contains the following keys:

  • 'uri' (string) — A publically reachable WebSocket URI controlled by the customer for the destination of the connect call. (f.e. wss://service.com/wsendpoint)
  • 'streams' (array) — (Optional) The stream IDs of the participants' whose audio is going to be connected. If not provided, all streams in session will be selected.
  • 'headers' (array) — (Optional) An object of key/val pairs with additional properties to send to your Websocket server, with a maximum length of 512 bytes.
Return values
array<string|int, mixed>

$response Response from the API, structured as follows:

  • 'id' (string) — A unique ID identifying the Audio Connector WebSocket.
  • 'connectionId' (string) — Opentok client connectionId that has been created. This connection will subscribe and forward the streams defined in the payload to the WebSocket, as any other participant, will produce a connectionCreated event on the session.

createSession()

Creates a new OpenTok session and returns the session ID, which uniquely identifies the session.

public createSession([array<string|int, mixed> $options = array() ]) : Session

For example, when using the OpenTok JavaScript library, use the session ID when calling the OT.initSession() method (to initialize an OpenTok session).

OpenTok sessions do not expire. However, authentication tokens do expire (see the generateToken() method). Also note that sessions cannot explicitly be destroyed.

A session ID string can be up to 255 characters long.

Calling this method results in an OpenTokException in the event of an error. Check the error message for details.

You can also create a session by logging in to your OpenTok Video API account.

Parameters
$options : array<string|int, mixed> = array()

(Optional) This array defines options for the session. The array includes the following keys (all of which are optional):

  • 'archiveMode' (ArchiveMode) — Whether the session is automatically archived (ArchiveMode::ALWAYS) or not (ArchiveMode::MANUAL). By default, the setting is ArchiveMode.MANUAL, and you must call the OpenTok->startArchive() method to start archiving. To archive the session (either automatically or not), you must set the mediaMode key to MediaMode::ROUTED.
  • 'e2ee' (Boolean) — Whether to enable end-to-end encryption for a routed session.
  • archiveName (String) — Name of the archives in auto archived sessions
  • archiveResolution (Enum) — Resolution of the archives in auto archived sessions. Can be one of "480x640", "640x480", "720x1280", "1280x720", "1080x1920", "1920x1080"
  • 'location' (String) — An IP address that the OpenTok servers will use to situate the session in its global network. If you do not set a location hint, the OpenTok servers will be based on the first client connecting to the session.
  • 'mediaMode' (MediaMode) — Whether the session will transmit streams using the OpenTok Media Router (MediaMode.ROUTED) or not (MediaMode.RELAYED). By default, the mediaMode property is set to MediaMode.RELAYED.

    With the mediaMode parameter set to MediaMode.RELAYED, the session will attempt to transmit streams directly between clients. If clients cannot connect due to firewall restrictions, the session uses the OpenTok TURN server to relay audio-video streams.

    The OpenTok Media Router provides the following benefits:

    • The OpenTok Media Router can decrease bandwidth usage in multiparty sessions. (When the mediaMode parameter is set to MediaMode.ROUTED, each client must send a separate audio-video stream to each client subscribing to it.)
    • The OpenTok Media Router can improve the quality of the user experience through recovery. With these features, if a client's connectivity degrades to a degree that it does not support video for a stream it's subscribing to, the video is dropped on that client (without affecting other clients), and the client receives audio only. If the client's connectivity improves, the video returns.
    • The OpenTok Media Router supports the archiving feature, which lets you record, save, and retrieve OpenTok sessions.
Return values
Session

A Session object representing the new session. Call the getSessionId() method of this object to get the session ID. For example, when using the OpenTok.js library, use this session ID when calling the OT.initSession() method.

deleteArchive()

Deletes an OpenTok archive.

public deleteArchive(string $archiveId) : bool

You can only delete an archive which has a status of "available", "uploaded", or "deleted". Deleting an archive removes its record from the list of archives. For an "available" archive, it also removes the archive file, making it unavailable for download. For a "deleted" archive, the archive remains deleted.

Parameters
$archiveId : string

The archive ID of the archive you want to delete.

Tags
throws
ArchiveException

There archive status is not "available", "updated", or "deleted".

Return values
bool

Returns true on success.

dial()

Initiates an outgoing SIP call.

public dial(string $sessionId, string $token, string $sipUri[, array<string|int, mixed> $options = [] ]) : SipCall

For more information, see the OpenTok SIP Interconnect developer guide.

Parameters
$sessionId : string

The ID of the OpenTok session that the participant being called will join.

$token : string

The OpenTok token to be used for the participant being called. You can add token data to identify that the participant is on a SIP endpoint or for other identifying data, such as phone numbers. Generate a token using the OpenTok::generateToken() or Session::generateToken() method.

$sipUri : string

The SIP URI to be used as destination of the SIP Call initiated from OpenTok to the Third Party SIP Platform.

If the URI contains a transport=tlsheader, the negotiation between TokBox and the SIP endpoint will be done securely. Note that this will only apply to the negotiation itself, and not to the transmission of audio. To have audio transmission be encrypted, see the "secure" property of the options parameter.

This is an example of secure call negotiation: "sip:access@thirparty.com;transport=tls".

This is an example of insecure call negotiation: "sip:access@thirparty.com".

$options : array<string|int, mixed> = []

This array defines options for the SIP call. It includes the following keys, all of which are optional:

  • 'headers' (array) — Headers​: Custom Headers to be added to the SIP INVITE request initiated from OpenTok to the Third Party SIP Platform.
  • 'auth' (array) — Auth​: Username and Password to be used in the SIP INVITE request for HTTP Digest authentication in case this is required by the Third Party SIP Platform.
    • 'username' (string) — The username to be used in the the SIP INVITE​ request for HTTP digest authentication (if one is required).
    • 'password' (string) — The password to be used in the the SIP INVITE​ request for HTTP digest authentication.
  • 'secure' (Boolean) — Indicates whether the media must be transmitted encrypted (true, the default) or not (false).
  • 'observeForceMute' (Boolean) — Whether the SIP endpoint should honor force mute moderation (True) or not (False, the default).
  • 'from' (string) — The number or string that will be sent to the final SIP number as the caller. It must be a string in the form of "from@example.com", where from can be a string or a number. If from is set to a number (for example, "14155550101@example.com"), it will show up as the incoming number on PSTN phones. If from is undefined or set to a string (for example, "joe@example.com"), +00000000 will show up as the incoming number on PSTN phones.
Return values
SipCall

An object contains the OpenTok connection ID and stream ID for the SIP call's connection in the OpenTok session. You can use the connection ID to terminate the SIP call, using the OpenTok::method_forceDisconnect() method.

disableForceMute()

Disables the active mute state of the session. After you call this method, new streams published to the session will no longer have audio muted.

public disableForceMute(string $sessionId, array<string|int, string> $options) : bool

After you call the OpenTok->forceMuteAll() method any streams published after the call are published with audio muted. Call the disableForceMute() method to remove the mute state of a session, so that new published streams are not automatically muted.

Parameters
$sessionId : string

The OpenTok session ID.

$options : array<string|int, string>

This array defines options and includes the following keys:

  • 'excludedStreams' (array, optional) — An array of stream IDs corresponding to streams that should not be muted. This is an optional property. If you omit this property, all streams in the session will be muted.
Return values
bool

Whether the call succeeded or failed.

forceDisconnect()

Disconnects a specific client from an OpenTok session.

public forceDisconnect(string $sessionId, string $connectionId) : mixed
Parameters
$sessionId : string

The OpenTok session ID that the client is connected to.

$connectionId : string

The connection ID of the connection in the session.

Return values
mixed

forceMuteAll()

Force all streams (except for an optional list of streams) in an OpenTok session to mute published audio.

public forceMuteAll(string $sessionId, array<string|int, string> $options) : bool

In addition to existing streams, any streams that are published after the call to this method are published with audio muted. You can remove the mute state of a session OpenTok->disableForceMute() method.

Also see the OpenTok->forceMuteStream() method.

Parameters
$sessionId : string

The OpenTok session ID.

$options : array<string|int, string>

This array defines options and includes the following keys:

  • 'excludedStreams' (array, optional) — An array of stream IDs corresponding to streams that should not be muted. This is an optional property. If you omit this property, all streams in the session will be muted.
Return values
bool

Whether the call succeeded or failed.

forceMuteStream()

Force the publisher of a specific stream to mute its published audio.

public forceMuteStream(string $sessionId, string $streamId) : bool

Also see the OpenTok->forceMuteAll() method.

Parameters
$sessionId : string

The OpenTok session ID containing the stream.

$streamId : string

The stream ID.

Return values
bool

Whether the call succeeded or failed.

generateToken()

Creates a token for connecting to an OpenTok session.

public generateToken(string $sessionId[, array<string|int, mixed> $options = array() ]) : string

In order to authenticate a user connecting to an OpenTok session, the client passes a token when connecting to the session.

For testing, you generate tokens or by logging in to your OpenTok Video API account.

Parameters
$sessionId : string

The session ID corresponding to the session to which the user will connect.

$options : array<string|int, mixed> = array()

This array defines options for the token. This array includes the following keys, all of which are optional:

  • 'role' (string) — One of the constants defined in the RoleConstants class. The default role is publisher
  • 'expireTime' (int) — The timestamp for when the token expires, in milliseconds since the Unix epoch. The default expiration time is 24 hours after the token creation time. The maximum expiration time is 30 days after the token creation time.
  • 'data' (string) — A string containing connection metadata describing the end-user. For example, you can pass the user ID, name, or other data describing the end-user. The length of the string is limited to 1000 characters. This data cannot be updated once it is set.
  • initialLayoutClassList (array) — An array of class names (strings) to be used as the initial layout classes for streams published by the client. Layout classes are used in customizing the layout of videos in live streaming broadcasts and composed archives.
Return values
string

The token string.

getArchive()

Gets an Archive object for the given archive ID.

public getArchive(string $archiveId) : Archive
Parameters
$archiveId : string

The archive ID.

Tags
throws
ArchiveException

There is no archive with the specified ID.

throws
InvalidArgumentException

The archive ID provided is null or an empty string.

Return values
Archive

The Archive object.

getBroadcast()

Gets information about an OpenTok broadcast.

public getBroadcast(string $broadcastId) : Broadcast
Parameters
$broadcastId : string

The ID of the broadcast.

Return values
Broadcast

An object with properties defining the broadcast.

getRender()

Fetch an existing render to view status. Status can be one of: <ul> <li><code>starting</code> &mdash; The Vonage Video API platform is in the process of connecting to the remote application at the URL provided. This is the initial state.</li> <li><code>started</code> &mdash; The Vonage Video API platform has succesfully connected to the remote application server, and is republishing that media into the Vonage Video API platform.</li> <li><code>stopped</code> &mdash; The Render has stopped.</li> <li><code>failed</code> &mdash; An error occurred and the Render could not proceed. It may occur at startup if the opentok server cannot connect to the remote application server or republish the stream. It may also occur at point during the rendering process due to some error in the Vonage Video API platform.</li> </ul>

public getRender( $renderId) : Render
Parameters
$renderId :
Return values
Render

getStream()

Gets an Stream object, providing information on a given stream.

public getStream(string $sessionId, string $streamId) : Stream
Parameters
$sessionId : string

The session ID for the OpenTok session containing the stream.

$streamId : string

The stream ID.

Return values
Stream

The Stream object.

listArchives()

Returns a list of archives for a session.

public listArchives(int $offset[, int $count = null ][, string $sessionId = null ]) : ArchiveList

The items() method of this object returns a list of archives that are completed and in-progress, for your API key.

Parameters
$offset : int

Optional. The index offset of the first archive. 0 is offset of the most recently started archive. 1 is the offset of the archive that started prior to the most recent archive. If you do not specify an offset, 0 is used.

$count : int = null

Optional. The number of archives to be returned. The maximum number of archives returned is 1000.

$sessionId : string = null

Optional. The OpenTok session Id for which you want to retrieve Archives for. If no session Id is specified, the method will return archives from all sessions created with the API key.

Return values
ArchiveList

An ArchiveList object. Call the items() method of the ArchiveList object to return an array of Archive objects.

listRenders()

Returns a list of Experience Composer renderers for an OpenTok project.

public listRenders(int $offset[, int $count = 50 ]) : mixed
Parameters
$offset : int
$count : int = 50
Return values
mixed

listStreams()

Returns a StreamList Object for the given session ID.

public listStreams(string $sessionId) : StreamList
Parameters
$sessionId : string

The session ID.

Return values
StreamList

A StreamList object. Call the items() method of the StreamList object to return an array of Stream objects.

playDTMF()

Plays a DTMF string into a session or to a specific connection

public playDTMF(string $sessionId, string $digits[, string $connectionId = null ]) : void
Parameters
$sessionId : string

The ID of the OpenTok session that the participant being called will join.

$digits : string

DTMF digits to play Valid DTMF digits are 0-9, p, #, and * digits. 'p' represents a 500ms pause if a delay is needed during the input process.

$connectionId : string = null

An optional parameter used to send the DTMF tones to a specific connection in a session.

Return values
void

setArchiveLayout()

Updates the stream layout in an OpenTok Archive.

public setArchiveLayout(string $archiveId, Layout $layoutType) : void
Parameters
$archiveId : string
$layoutType : Layout
Return values
void

setStreamClassLists()

Sets the layout class list for streams in a session.

public setStreamClassLists(string $sessionId[, array<string|int, mixed> $classListArray = array() ]) : mixed

Layout classes are used in the layout for composed archives and live streaming broadcasts. For more information, see Customizing the video layout for composed archives and Configuring video layout for OpenTok live streaming broadcasts.

Parameters
$sessionId : string

The session ID of the session the streams belong to.

$classListArray : array<string|int, mixed> = array()

The connectionId of the connection in a session.

Return values
mixed

signal()

Sends a signal to clients (or a specific client) connected to an OpenTok session.

public signal(string $sessionId, array<string|int, mixed> $payload[, string $connectionId = null ]) : mixed
Parameters
$sessionId : string

The OpenTok session ID where the signal will be sent.

$payload : array<string|int, mixed>

This array defines the payload for the signal. This array includes the following keys, of which type is optional:

  • 'data' (string) — The data string for the signal. You can send a maximum of 8kB.
  • 'type' (string) — (Optional) The type string for the signal. You can send a maximum of 128 characters, and only the following characters are allowed: A-Z, a-z, numbers (0-9), '-', '_', and '~'.
$connectionId : string = null

An optional parameter used to send the signal to a specific connection in a session.

Return values
mixed

startArchive()

Starts archiving an OpenTok session.

public startArchive(string $sessionId[, array<string|int, mixed> $options = [] ]) : Archive

Clients must be actively connected to the OpenTok session for you to successfully start recording an archive.

You can only record one archive at a time for a given session. You can only record archives of sessions that use the OpenTok Media Router (sessions with the media mode set to routed); you cannot archive sessions with the media mode set to relayed.

For more information on archiving, see the OpenTok archiving programming guide.

Parameters
$sessionId : string

The session ID of the OpenTok session to archive.

$options : array<string|int, mixed> = []

(Optional) This array defines options for the archive. The array includes the following keys (all of which are optional):

  • 'name' (String) — The name of the archive. You can use this name to identify the archive. It is a property of the Archive object, and it is a property of archive-related events in the OpenTok client SDKs.
  • 'hasVideo' (Boolean) — Whether the archive will record video (true, the default) or not (false). If you set both hasAudio and hasVideo to false, the call to the startArchive() method results in an error.
  • 'streamMode' (String) — Whether streams included in the archive are selected automatically (StreamMode.AUTO, the default) or manually (StreamMode.MANUAL). When streams are selected automatically (StreamMode.AUTO), all streams in the session can be included in the archive. When streams are selected manually (StreamMode.MANUAL), you specify streams to be included based on calls to the Archive.addStreamToArchive() and Archive.removeStreamFromArchive(). methods. With manual mode, you can specify whether a stream's audio, video, or both are included in the archive. In both automatic and manual modes, the archive composer includes streams based on stream prioritization rules.
  • 'hasAudio' (Boolean) — Whether the archive will record audio (true, the default) or not (false). If you set both hasAudio and hasVideo to false, the call to the startArchive() method results in an error.
  • 'multiArchiveTag' (String) (Optional) — Set this to support recording multiple archives for the same session simultaneously. Set this to a unique string for each simultaneous archive of an ongoing session. You must also set this option when manually starting an archive that is {https://tokbox.com/developer/guides/archiving/#automatic automatically archived}. Note that the `multiArchiveTag` value is not included in the response for the methods to {https://tokbox.com/developer/rest/#listing_archives list archives} and {https://tokbox.com/developer/rest/#retrieve_archive_info retrieve archive information}. If you do not specify a unique `multiArchiveTag`, you can only record one archive at a time for a given session. {https://tokbox.com/developer/guides/archiving/#simultaneous-archives See Simultaneous archives}.
  • 'outputMode' (OutputMode) — Whether all streams in the archive are recorded to a single file (OutputMode::COMPOSED, the default) or to individual files (OutputMode::INDIVIDUAL).
  • 'resolution' (String) — The resolution of the archive, either "640x480" (SD landscape, the default), "1280x720" (HD landscape), "1920x1080" (FHD landscape), "480x640" (SD portrait), "720x1280" (HD portrait), or "1080x1920" (FHD portrait). This property only applies to composed archives. If you set this property and set the outputMode property to "individual", a call to the method results in an error.
Return values
Archive

The Archive object, which includes properties defining the archive, including the archive ID.

startBroadcast()

Starts a live streaming broadcast of an OpenTok session.

public startBroadcast(string $sessionId[, array<string|int, mixed> $options = [] ]) : Broadcast
Parameters
$sessionId : string

The session ID of the session to be broadcast.

$options : array<string|int, mixed> = []

(Optional) An array with options for the broadcast. This array has the following properties:

  • layout (Layout) — (Optional) An object defining the initial layout type of the broadcast. If you do not specify an initial layout type, the broadcast stream uses the Best Fit layout type. For more information, see Configuring Video Layout for the OpenTok live streaming feature.
  • streamMode (String) — Whether streams included in the broadcast are selected automatically (StreamMode.AUTO, the default) or manually (StreamMode.MANUAL). When streams are selected automatically (StreamMode.AUTO), all streams in the session can be included in the broadcast. When streams are selected manually (StreamMode.MANUAL), you specify streams to be included based on calls to the Broadcast.addStreamToBroadcast() and Broadcast.removeStreamFromBroadcast() methods. With manual mode, you can specify whether a stream's audio, video, or both are included in the broadcast. In both automatic and manual modes, the broadcast composer includes streams based on stream prioritization rules.
  • multiBroadcastTag (String) (Optional) — Set this to support multiple broadcasts for the same session simultaneously. Set this to a unique string for each simultaneous broadcast of an ongoing session. Note that the `multiBroadcastTag` value is *not* included in the response for the methods to {https://tokbox.com/developer/rest/#list_broadcasts list live streaming broadcasts} and {https://tokbox.com/developer/rest/#get_info_broadcast get information about a live streaming broadcast}. {https://tokbox.com/developer/guides/broadcast/live-streaming#simultaneous-broadcasts See Simultaneous broadcasts}.
  • resolution — The resolution of the broadcast: either "640x480" (SD landscape, the default), "1280x720" (HD landscape), "1920x1080" (FHD landscape), "480x640" (SD portrait), "720x1280" (HD portrait), or "1080x1920" (FHD portrait).
  • outputs (Array) — Defines the HLS broadcast and RTMP streams. You can provide the following keys:
    • hls (Array) — available with the following options:

      • 'dvr' (Bool) — Whether to enable DVR functionality — rewinding, pausing, and resuming — in players that support it (true), or not (false, the default). With DVR enabled, the HLS URL will include a ?DVR query string appended to the end.
      • 'lowLatency' (Bool) — Whether to enable low-latency mode for the HLS stream. Some HLS players do not support low-latency mode. This feature is incompatible with DVR mode HLS broadcasts.

    • rtmp (Array) — An array of arrays defining RTMP streams to broadcast. You can specify up to five target RTMP streams. Each RTMP stream array has the following keys:
      • id (String) — The stream ID (optional)
      • serverUrl (String) — The RTMP server URL
      • streamName (String) — The stream name, such as the YouTube Live stream name or the Facebook stream key
Return values
Broadcast

An object with properties defining the broadcast.

startRender()

Starts an Experience Composer renderer for an OpenTok session.

public startRender( $sessionId,  $token,  $url,  $maxDuration,  $resolution,  $properties) : Render

For more information, see the Experience Composer developer guide.

Parameters
$sessionId :

(string) The session ID of the OpenTok session that will include the Experience Composer stream.

$token :

(string) A valid OpenTok token with a Publisher role and (optionally) connection data to be associated with the output stream.

$url :

(string) A publicly reachable URL controlled by the customer and capable of generating the content to be rendered without user intervention. The minimum length of the URL is 15 characters and the maximum length is 2048 characters.

$maxDuration :

(int) (optional) The maximum time allowed for the Experience Composer, in seconds. After this time, it is stopped automatically, if it is still running. The maximum value is 36000 (10 hours), the minimum value is 60 (1 minute), and the default value is 7200 (2 hours). When the Experience Composer ends, its stream is unpublished and an event is posted to the callback URL, if configured in the Account Portal.

$resolution :

(string) (optional) The resolution of the Experience Composer, either "640x480" (SD landscape), "480x640" (SD portrait), "1280x720" (HD landscape), "720x1280" (HD portrait), "1920x1080" (FHD landscape), or "1080x1920" (FHD portrait). By default, this resolution is "1280x720" (HD landscape, the default).

$properties :

(array) (optional) The initial configuration of Publisher properties for the composed output stream.

  • name (String) (optional) — Serves as the name of the composed output stream which is published to the session. The name must have a minimum length of 1 and a maximum length of 200.
Return values
Render

The render object, which includes properties defining the render, including the render ID.

stopArchive()

Stops an OpenTok archive that is being recorded.

public stopArchive(string $archiveId) : Archive

Archives automatically stop recording after 120 minutes or when all clients have disconnected from the session being archived.

Parameters
$archiveId : string

The archive ID of the archive you want to stop recording.

Return values
Archive

The Archive object corresponding to the archive being stopped.

stopBroadcast()

Stops a broadcast.

public stopBroadcast(string $broadcastId) : mixed
Parameters
$broadcastId : string

The ID of the broadcast.

Return values
mixed

stopRender()

Stops an existing render.

public stopRender( $renderId) : mixed
Parameters
$renderId :
Return values
mixed

updateStream()

Sets the layout class list for a stream.

public updateStream(string $sessionId, string $streamId[, array<string|int, mixed> $properties = array() ]) : mixed

Layout classes are used in the layout for composed archives and live streaming broadcasts.

For more information, see Customizing the video layout for composed archives and Configuring video layout for OpenTok live streaming broadcasts.

You can set the initial layout class list for streams published by a client when you generate the token used by the client to connect to the session. See the OpenTok::generateToken() method.

Parameters
$sessionId : string

The session ID of the session the stream belongs to.

$streamId : string

The stream ID.

$properties : array<string|int, mixed> = array()

An array containing one property: $layoutClassList. This property is an array of class names (strings) to apply to the stream. Set $layoutClassList to an empty array to clear the layout class list for a stream. For example, this code sets the stream to use two classes:

$streamProperties = array(
  '$layoutClassList' => array('bottom', 'right')
);
$opentok->updateStream($sessionId, $streamId, $streamProperties);
Return values
mixed

Search results