OpenTok broadcast lets you share live OpenTok sessions with many viewers.
The OpenTok platform supports two different types of broadcast:
Live interactive video broadcasts — This type of broadcast enables many clients to publish and subscribe to each others' audio-video streams in real time. Routed OpenTok sessions can support live interactive video broadcasts for up to 3,000 streams between clients. For details, see Live interactive video broadcasts.
Live streaming broadcasts — This type of broadcast lets you share an HTTP live streaming (HLS) stream or an RTMP stream with large numbers of viewers. The HLS or RTMP stream is a single video composed of the individual streams published to the OpenTok session. For details, see Live streaming broadcasts.
Both types of broadcast require you to use a routed OpenTok session (a session that uses the OpenTok Media Router).
The large interactive video broadcast feature is built on WebRTC, enabling ultra-low latency delivery of content that in turn enables real-time interactions among participants.
HLS uses CDN for delivery and is a traditional broadcast with high latency (15–20 seconds) and no interaction.
RTMP has lower latency (around 5 seconds) than HLS. It also does not lend itself to use-cases that require interactivity.
If your use-case requires interactivity, you should use the large interactive video broadcast feature to serve your real-time audience. Each audience member could potentially publish a stream to the session to interact with other publishers of live streams (such as a host or presenter).
HLS should be used to serve the "burst capacity" — when the audience size exceeds what can be supported in real time in a live streaming interactive broadcast. An HLS viewer will receive the content at a latency of 15–20 seconds, so it does not lend itself directly to interactive use-cases.
Customers could build additional logic in their application to move a viewer from HLS to real-time and vice-versa. In this case, the application may include capabilities to to manage the latency difference between the HLS and real-time viewer.
You can serve HLS content to viewers on clients that do not support WebRTC.
Use RTMP to push content created on OpenTok to social media video platforms, such as Facebook or YouTube Live.
More clients can simultaneously view an HLS or RTMP stream than can view a live interactive video session. For example, you may provide an HLS stream to a client if the OpenTok session has reached the 3,000-connection limit for OpenTok live interactive broadcasts. HLS streams support an unlimited number of viewers. RTMP streams are limited by the number of viewers supported by the RTMP provider.
For a sample app that shows how to use both the live interactive video broadcast and live streaming features, see the OpenTok broadcast-sample-app repo on GitHub.