Suggestions

close search

Add Messaging, Voice, and Authentication to your apps with Vonage Communications APIs

Visit the Vonage API Developer Portal

Broadcast

An object representing an OpenTok live streaming broadcast.

Do not call the new() constructor. To start a live streaming broadcast, call the OpenTok.startBroadcast() method.

Properties:
Name Type Description
id String The broadcast ID.
sessionId String The session ID of the OpenTok session associated with this broadcast.
projectId String The API key associated with the broadcast.
createdAt Number The time at which the broadcast was created, in milliseconds since the UNIX epoch.
resolution String The resolution of the broadcast: one of the following:
  • "640x480"
  • "1280x720"
  • "1920x1080"
  • "480x640"
  • "720x1280"
  • "1080x1920"
You may want to use a portrait aspect ratio for broadcasts that include video streams from mobile devices (which often use the portrait aspect ratio). This property is optional.
broadcastUrls Object An object containing details about the HLS and RTMP broadcasts.

  • hls (String) — If you specified an HLS endpoint, the object includes an hls property, which is set to the URL for the HLS broadcast. Note this HLS broadcast URL points to an index file, an .M3U8-formatted playlist that contains a list of URLs to .ts media segment files (MPEG-2 transport stream files). While the URLs of both the playlist index file and media segment files are provided as soon as the HTTP response is returned, these URLs should not be accessed until 15 – 20 seconds later, after the initiation of the HLS broadcast, due to the delay between the HLS broadcast and the live streams in the OpenTok session. See https://developer.apple.com/library/ios/technotes/tn2288/_index.html for more information about the playlist index file and media segment files for HLS.
  • rtmp (Object Array) — If you specified RTMP stream endpoints, the object includes an rtmp property. This is an array of objects that include information on each of the RTMP streams. Each of these objects has the following properties:
    • id The ID you assigned to the RTMP stream
    • serverUrl The server URL
    • streamName The stream name
    • status The status of the stream
maxDuration Number The maximum time allowed for the broadcast, in seconds. After this time, the broadcast will be stopped automatically, if it is still started.
streamMode String The stream mode for the broadcast. This can be set to one of the the following:
streams Array An array of objects corresponding to streams currently being broadcast. This is only set for a broadcast with the status set to "started" and the streamMode set to "manual". Each object in the array includes the following properties:
  • streamId -- The stream ID of the stream included in the broadcast.
  • hasAudio -- Whether the stream's audio is included in the broadcast.
  • hasVideo -- Whether the stream's video is included in the broadcast.
multiBroadcastTag String 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 list live streaming broadcasts and get information about a live streaming broadcast.

Methods

Name Description
stop(callback) Stops the live streaming broadcast.

stop(callback)

Stops the live streaming broadcast.

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

Parameters:
Name Type Description
callback function The function to call upon completing the operation. Two arguments are passed to the function:
  • error — An error object (if the call to the method fails).
  • broadcast — The Broadcast object.