Blog

How to choose a live streaming API: what to compare before you build

· Andrij Tkachenko · 14 min read

A clipboard with a checklist beside a camera on a tripod, its signal reaching a laptop, a phone and a tablet, each with a play button

Choose a live streaming API by how far behind live your viewers are and by what its bill counts: whether the picture reaches them many seconds late or about a second behind the host, whether they can talk back while it still matters, and whether you are billed by viewer minutes, hours of video or gigabytes sent. A player, a studio and an embed code are on every feature list, so it is those answers that tell services apart.

This post goes through ten questions to ask of any live streaming API, livestream SDK or video streaming API, with why each one matters and how to check the answer yourself. It names no service. At the end it answers every question for WordPlus Cloud, with what it leaves to you.

A broadcast, or a stream that talks back

Two kinds of service are sold under these words, and they are built on different protocols.

A broadcast service cuts the stream into short files, segments of a few seconds each, and sends them to viewers over plain HTTP, most often as HLS. Files travel through any network and any cache, so it carries a stream to a very large audience, a number of seconds behind live. A realtime service sends the stream over WebRTC, the protocol of video calls, frame by frame through its media servers, so viewers see it about as soon as a call would show it, and their chat, reactions and questions arrive while the host is still on the subject.

Broadcast over HLS Realtime over WebRTC
Behind live Many seconds About a second
Sent as Files over HTTP Packets, as in a call
The audience Watches Watches and takes part

Neither is better in general. A match that a whole country watches without writing a word is a broadcast. A class, a launch with questions or a talk with a chat beside it is a stream that talks back. Know which one you build before you compare prices, as the two are priced in different ways too.

1. How far behind live is a viewer?

The delay comes from how the stream travels. HLS sends a segment only once it is complete, and a player keeps several in hand: the HLS standard tells a player to start at least three target durations from the live end of the playlist, and Apple's authoring guide recommends a target duration of 6 seconds. That puts a viewer 18 seconds or more behind. Low-Latency HLS sends parts of each segment as they are made, one second each by the same guide, and a player still holds at least three of them, so a few seconds remain.

WebRTC has no segments. It sends each frame as soon as it is encoded, as it does in a call.

Two seconds matter little to someone watching a film. They matter a lot to a teacher who asks "can everyone see this?", or to a host who reads the chat aloud and answers it.

Ask:

  • How far behind the host is a viewer, from the camera to the screen, and how was it measured?
  • Does the chat arrive in step with the picture, or ahead of it?
  • Does the delay grow during a long stream, and what brings it back?

2. How does the picture get in?

A host goes live from somewhere: the camera of a browser or a phone, a shared screen, or an encoder such as OBS that mixes scenes and cameras. A browser or a phone needs nothing installed. An encoder sends the stream over a protocol of its own, most often RTMP, an older protocol that carries video over TCP, or WHIP, the IETF standard for sending a stream into a WebRTC service with one HTTP request and a bearer token. OBS has it from version 30.

Ask:

  • Can a host go live from a browser, with nothing to install?
  • Which encoder protocols does it take, and with which encoders has it been tried?
  • When the encoder drops for a minute, does the stream wait for it, or end?
  • Can a stream key that leaked be replaced, and does the old one stop working?

3. What does each viewer get?

People watch on a phone with one bar of mobile data and on a large screen on fibre, at the same time. A service that sends everyone one picture fails one of them. There are two ways around it. A broadcast service usually encodes the stream again at several sizes, a ladder of qualities, and the player picks one by its connection. A realtime service often has the host send several sizes at once, simulcast, and its media servers forward each viewer the one that fits (how media servers work).

Ask:

  • How many qualities, up to which resolution, and who picks: the player, the viewer, or both?
  • On a weak connection, does the picture get smaller before it stalls?
  • Can my page read how the stream plays for a viewer, to help someone whose picture freezes?

4. How close are the servers, and do they get through?

A viewer far from the server waits for every packet to cross the distance, and loses more of them on the way. Ask where the media servers run, and whether each viewer reaches one of their own region by themselves. How to connect users across regions goes through what each answer means.

The network in between counts as much. HLS travels like any web page, through any firewall that lets the web out. WebRTC prefers UDP, which many offices and hotels block, so a realtime service needs a way in on the ports of the web as well. Our post on WebRTC ports lists what a firewall must allow.

Ask:

  • Where are the media servers, and does each viewer join the nearest?
  • Does a viewer on a network that lets out only the web still get the picture?

5. What does the bill count?

Most live streaming APIs count viewer minutes, a minute of one person watching. A stream to 1,000 people for an hour is 60,000 of them, so the size of your audience matters more than how many streams you run. Some count hours of video encoded or gigabytes delivered instead, or as well.

Then read what else is counted. Some prices rise with the resolution, some count the time a page waits before the stream starts, and recording, storage, the chat and each encoder can each be a line of its own. How much video calls cost per minute works a whole month through, a live stream in it.

Ask:

  • Is a minute at 1080p counted like a minute at 360p?
  • Is a viewer counted from opening the page, or from the moment the stream goes live?
  • What happens past the plan: are new viewers refused, those watching cut off, or the extra billed?

6. Who may watch, and who may go live?

A stream for everyone needs only its link. A stream for the members of a club, the students of a course or the holders of a ticket needs more, as a link is easily passed on. With most APIs your server signs a token for each viewer or for each stream, and what differs is how much the token says, and whether a token signed for one person works for another.

Ask:

  • Can someone without an account watch, and can I turn that off for one stream?
  • Does a link passed on open a members-only stream?
  • Can I take a viewer out during the stream, and keep them out?
  • Who may go live on a stream, and how is that checked?

7. Is the chat part of the stream?

A stream that talks back needs a chat beside it, and a chat with an audience needs keeping: pinning a message, deleting one, slowing everyone down, muting someone for a while, banning someone. Some APIs bring a chat with the stream, others leave it to a second service with a bill of its own.

Ask:

  • Does the chat come with the stream, on the same connection and the same sign-in?
  • Who keeps it, and can my server do the same with no page open?
  • How many messages does it keep, and for how long?

8. Can a viewer come on stage?

A question asked aloud, an interview, a panel: each needs a viewer to come on with their camera and microphone, for everyone watching to see, without a second call app. Only the realtime kind can do it, as a viewer many seconds behind cannot talk with the host.

Ask:

  • Can a viewer raise a hand, and the host bring them on and take them off?
  • How do guests appear: side by side, the one speaking large, or one person in the spotlight?

9. Is there a ready-made player and studio?

A player is more than a video element. Browsers play sound only once someone has clicked or typed on the site (MDN on autoplay), so a viewer who opens a stream from a link may see it silent, and the player needs a way to turn the sound on. It says when the stream has not started yet, plays as soon as it does with no reload, and shows the chat and how many watch. The host needs a studio: the camera before going live, the screen, the encoder, Go live and End. A ready-made one saves weeks, and it has to look like the rest of your app.

Ask:

  • Which platforms have one: the web, React, iOS, Android?
  • Can I restyle it, and place the player and the chat apart?
  • Is the rest of the SDK there for a player of my own?
  • Is there a server library in the language I write, or an HTTP API?

10. What does your server hear back, and what stays?

Your app needs to know what happened: when a stream went live and ended, who watched and for how long. It needs that to show what is live now, to tell followers, or to bill your own users by the view or by the minute. Webhooks bring it, and as a webhook may come twice, each one needs an id.

Then read the limits page: how long a stream may run, how many may watch, how long a stream key lives. And ask what stays once a stream ends: a recording, its replay, its chat.

Try it for an afternoon

A feature table answers few of these. A small test answers most. Build the smallest stream you can on each service you are weighing, and run these eight steps:

  1. Go live from a browser, and watch on a phone using mobile data. Put a clock that shows seconds in front of the camera, and photograph it beside the screen of the phone: the difference is the delay.
  2. Ask a question aloud, and have the viewer answer it in the chat. See how long the answer takes to reach you.
  3. In the developer tools of the viewer's browser, slow the network down. See whether the picture gets smaller or stops.
  4. Watch from a network that lets out only the web, such as a strict office or hotel Wi-Fi. Our connection test shows beforehand what that network lets through.
  5. Open the stream from a link in a new tab, and see what the player does about the sound.
  6. Open a members-only stream in a private window, signed out, with the link a member has.
  7. Stop the encoder for a minute and start it again. See whether the viewers are still there.
  8. Open the usage page of the service, and read what the afternoon was counted as.

How WordPlus Cloud answers them

WordPlus Cloud is of the second kind: a live streaming API and SDK over WebRTC, with a ready-made player, studio and chat, on media servers we run ourselves. The same ten questions, in order:

  1. Viewers watch about a second behind the host, over WebRTC with no segments, and the chat and reactions come on the same connection, in step with the picture.
  2. A host goes live from the camera and microphone of a browser or a phone, shares a screen, or streams from OBS or any other encoder over WHIP. The studio gives the host an address and a key for the encoder, and a new key cuts off the old one. We take WHIP, not RTMP. A live stream whose encoder stays gone for 5 minutes ends, unless someone on its stage still sends a camera or a screen.
  3. The host sends up to 1080p, and each viewer gets a layer that fits, chosen by the size of the player and the connection, up to Full HD in a large player. A viewer may also choose a layer, up to 720p. Each page can read, once a second, how the stream plays for its viewer: the picture and the sound that arrive, what is lost, the round trip, how long the picture took to start, stalls and reconnects.
  4. Our media servers run in several regions, and each viewer joins one of their own region by themselves, our servers passing the stream between regions on private links. The network page shows them on a map. A viewer on a network that lets out only the web still gets the stream, on port 443.
  5. The bill counts concurrent connections, starting from 1,000: $11.99 a month billed yearly, or $14.99 billed monthly. Each viewer holds one. With 1,000 connections, 50 viewers at once take no credits, and each further 1,000 connections add 20. Above that, each viewer takes a credit a minute, counted only while the stream is live, which is $0.20 per 1,000 viewer minutes, and your plan adds 5,000 credits a month for each 1,000 connections. One price at every resolution, and bandwidth, relays and chat messages are never charged. A stream to 1,000 viewers for an hour, 4 times a month, comes to about $56.59 with the plan. Once your credits and a month of borrowing are used, new viewers above what the plan includes are not let in until you add credits or the month ends, and those watching go on.
  6. Your server decides who is who, with a rule for each kind of stream: it refuses someone, or makes them a viewer, a viewer who only reads the chat, a moderator, or the host. A visitor who is not signed in watches when your rule says so. Otherwise the stream is for members only, and a link passed on opens nothing. A stream is for everyone watching it, so it is encrypted on its way but not end to end: our media servers see it, as a stream needs.
  7. The chat comes with the stream, on the same connection, with reactions over the picture. The host and the moderators your server names pin and delete messages, slow the chat down to a message every so many seconds, up to 300, mute someone for a minute up to a day, and remove or ban them. Your server does all of it with no page open, and writes in the chat under a name of its own. The chat keeps its last 200 messages, for a day after the last one.
  8. Viewers come on stage. A viewer raises a hand, the host invites them, and everyone watching sees them beside the host with their camera and microphone, up to 720p, in a grid, the one speaking large, or one person in the spotlight. A visitor who is not signed in watches, and does not come on stage.
  9. A ready-made player, studio and chat, as one element on any page, <LiveStream> in React, and native screens on iOS and Android. Place the player and the chat apart, restyle them, or draw a player of your own on the same SDK. They speak nine languages, and the player shows Turn sound on when the browser starts it silent. Server libraries for Node.js, PHP and Python, guides for Next.js, Express, Laravel, plain PHP, Django, FastAPI and Flask, and an HTTP API for any other language.
  10. Your server hears each stream go live and end by webhook, and each signed-in viewer start and stop watching, with the seconds of live time, counted on our servers. Each event has an id, so a repeat is kept once, and your server can list the streams live now with how many watch each. The limits are published: a viewer's pass to a stream lasts 10 minutes and the page renews it, and a stream key is kept until a year passes in which nobody uses it.

The live streams guide has the code of each part in every stack. How to implement live streaming in Next.js builds a whole live classes site step by step, and its live demo lets you go live as a teacher and watch as a student in another window.

What it leaves to you

  • The rule. Who hosts and who watches is your own logic, so it is code you write, with the route that asks it, and so is the record your webhook keeps of each stream.
  • Telling people a stream started. Your server hears it go live, and the email or the notice is yours to send.
  • Recordings and replays. The SDKs for apps record no streams today.
  • RTMP. An encoder that sends only RTMP needs a newer version, or another encoder with WHIP, such as OBS 30 or later.
  • A stream that only goes out. Each viewer holds a connection of your plan, as everyone in a realtime stream stays connected. An audience that never writes and does not mind a delay of many seconds fits a broadcast service over HLS.

Start with the live streams guide

WordPlus Cloud for Apps is priced by concurrent connections, starting from 1,000, billed monthly or yearly. The same plan and SDK bring calls, group calls and chat on the same connection. See the live streaming API and SDK with its live demo and every stack, what the cloud does for apps, or the apps pricing. Choosing for calls and chat too? How to choose a video call API asks the same of calls, and how to choose a chat API of messages. Questions about your integration? Write to us.