close search

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

Visit the Vonage API Developer Portal

Class: OpenTok::Broadcast

Defined in:


Represents a live streaming broadcast of an OpenTok session. See / Live streaming broadcasts.

Instance Attribute Summary

Instance Method Summary

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object

Instance Attribute Details


is defined as follows: This object defines the types of broadcast streams you want to start (both HLS and RTMP). You can include HLS, RTMP, or both as broadcast streams. If you include RTMP streaming, you can specify up to five target RTMP streams (or just one). The (:hls) property is set to an empty [Hash] object. The HLS URL is returned in the response. The (:rtmp) property is set to an [Array] of Rtmp [Hash] properties. For each RTMP stream, specify (:serverUrl) for the RTMP server URL, (:streamName) such as the YouTube Live stream name or the Facebook stream key), and (optionally) (:id), a unique ID for the stream.


  • (Hash)

    the current value of broadcastUrls


The time at which the broadcast was created, in milliseconds since the UNIX epoch.


  • (int)

    the current value of created_at


The broadcast ID.


  • (string)

    the current value of id


The API key associated with the broadcast.


  • (string)

    the current value of project_id


The resolution of the broadcast: either “640x480” (SD, the default) or “1280x720” (HD). This property is optional.


  • (string)

    the current value of resolution


The session ID of the OpenTok session associated with this broadcast.


  • (string)

    the current value of session_id


The status of the RTMP stream.

  • “connecting” – The OpenTok platform is in the process of connecting to the remote RTMP server.

    This is the initial state, and it is the status if you start when there are no streams published in the session.
    It changes to "live" when there are streams (or it changes to one of the other states).
  • “live – The OpenTok platform has successfully connected to the remote RTMP server, and the media is streaming.

  • “offline” – The OpenTok platform could not connect to the remote RTMP server. This is due to an unreachable server or an error in the RTMP handshake. Causes include rejected RTMP connections, non-existing RTMP applications, rejected stream names, authentication errors, etc. Check that the server is online, and that you have provided the correct server URL and stream name.

  • “error” – There is an error in the OpenTok platform.


  • (string)

    the current value of status


For this start method, this timestamp matches the createdAt timestamp.


  • (int)

    the current value of updated_at

Instance Method Details

#layout(opts = {}) ⇒ Object

Sets the layout of the OpenTok broadcast.

You can dynamically change the layout type of a broadcast while it is being broadcast. For more information, see Configuring video layout for OpenTok live streaming broadcasts.

Refer to


  • options (Hash)

    a customizable set of options


  • (OpenTokBroadcastError)

    The broadcast layout could not be updated.

  • (OpenTokAuthenticationError)

    Authentication failed. Invalid API key or secret.

  • (OpenTokError)

    OpenTok server error.

  • (ArgumentError)

    The broadcast_id or options parameter is empty.

  • (ArgumentError)

    The “custom” type was specified without a stylesheet option.

  • (ArgumentError)

    A stylesheet was passed in for a type other than custom. Or an invalid type was passed in.

  • (ArgumentError)

    An invalid layout type was passed in.


Stops the OpenTok broadcast.


A JSON-encoded string representation of the broadcast.