Broadcast
in package
Represents a broadcast of an OpenTok session.
Table of Contents
- $broadcastUrls : object
- $createdAt : int
- $id : string
- $isDvr : bool
- $isHls : bool
- $isLowLatency : bool
- $isStopped : bool
- $multiBroadcastTag : string
- $partnerId : string
- $resolution : string
- $sessionId : string
- $streamMode : string
- $updatedAt : int
- __construct() : mixed
- addStreamToBroadcast() : bool
- Adds a stream to a currently running broadcast that was started with the the streamMode set to StreamMode.Manual. You can call the method repeatedly with the same stream ID, to toggle the stream's audio or video in the broadcast.
- jsonSerialize() : mixed
- removeStreamFromBroadcast() : bool
- Removes a stream from a currently running broadcast that was started with the the streamMode set to StreamMode.Manual.
- stop() : mixed
- Stops the broadcast.
- updateLayout() : mixed
- Updates the layout of the broadcast.
Properties
$broadcastUrls
public
object
$broadcastUrls
Details on the HLS and RTMP broadcast streams. For an HLS stream, the URL is provided. See the OpenTok live streaming developer guide for more information on how to use this URL. For each RTMP stream, the RTMP server URL and stream name are provided, along with the RTMP stream's status.
$createdAt
public
int
$createdAt
The timestamp when the broadcast was created, expressed in seconds since the Unix epoch.
$id
public
string
$id
The unique ID for the broadcast.
$isDvr
public
bool
$isDvr
Whether the broadcast supports DVR functionality for the HLS stream.
$isHls
public
bool
$isHls
Whether the broadcast supports HLS.
$isLowLatency
public
bool
$isLowLatency
Whether the broadcast supports low-latency mode for the HLS stream.
$isStopped
public
bool
$isStopped
Whether the broadcast is stopped (true) or in progress (false).
$multiBroadcastTag
public
string
$multiBroadcastTag
Whether Multiple Broadcast is switched on, which will be a unique string for each simultaneous broadcast of an ongoing session. See https://tokbox.com/developer/guides/archiving/#simultaneous-archives for more information.
$partnerId
public
string
$partnerId
Your OpenTok API key.
$resolution
public
string
$resolution
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). You may want to use a portrait aspect ratio for archives that include video streams from mobile devices (which often use the portrait aspect ratio).
$sessionId
public
string
$sessionId
The OpenTok session ID.
$streamMode
public
string
$streamMode
Whether streams included in the broadcast are selected automatically (StreamMode.AUTO
)
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.
$updatedAt
public
int
$updatedAt
The time the broadcast was started or stopped, expressed in seconds since the Unix epoch.
Methods
__construct()
public
__construct(mixed $broadcastData[, mixed $options = array() ]) : mixed
Parameters
- $broadcastData : mixed
- $options : mixed = array()
Return values
mixed —addStreamToBroadcast()
Adds a stream to a currently running broadcast that was started with the the streamMode set to StreamMode.Manual. You can call the method repeatedly with the same stream ID, to toggle the stream's audio or video in the broadcast.
public
addStreamToBroadcast(string $streamId, bool $hasAudio, bool $hasVideo) : bool
Parameters
- $streamId : string
-
The stream ID.
- $hasAudio : bool
-
Whether the broadcast should include the stream's audio (true, the default) or not (false).
- $hasVideo : bool
-
Whether the broadcast should include the stream's video (true, the default) or not (false).
Return values
bool —Returns true on success.
jsonSerialize()
public
jsonSerialize() : mixed
Return values
mixed —removeStreamFromBroadcast()
Removes a stream from a currently running broadcast that was started with the the streamMode set to StreamMode.Manual.
public
removeStreamFromBroadcast(string $streamId) : bool
Parameters
- $streamId : string
-
The stream ID.
Return values
bool —Returns true on success.
stop()
Stops the broadcast.
public
stop() : mixed
Return values
mixed —updateLayout()
Updates the layout of the broadcast.
public
updateLayout(Layout $layout) : mixed
See Configuring video layout for OpenTok live streaming broadcasts.
Parameters
- $layout : Layout
-
An object defining the layout type for the broadcast.