livqenoDocs

Live StreamingNetwork Quality

Network Quality

Hosts and viewers reconnect like any RTC participant. The one thing to plan for is token expiry.

Networks drop: a host walks out of Wi-Fi range, a viewer's phone switches to cellular. This page explains what happens then, and how to keep your stream running.

Where this fits: hosts and viewers are normal RTC room participants. So everything in RTC → Reconnection & network quality works here too. This page covers the parts that matter for live streams.

What happens when the network drops

  1. The SDK notices the connection is gone and fires reconnecting.
  2. It tries to rejoin on its own, waiting a little longer between each try.
  3. If it gets back in, it fires reconnected. Video and chat carry on.
  4. If every try fails, it gives up with CONNECTION_FAILED.

While a host is reconnecting, viewers just see the video freeze or go blank. The stream itself stays LIVE. The time a host spends reconnecting doesn't count toward host-hours.

To check live quality (bitrate, packet loss, round-trip time), use room.getConnectionStats(). See Diagnostics.

Show a "reconnecting" banner

Show the user what's happening, so they don't think your app froze. In your app:

stream.room.on('reconnecting', () => showBanner('Reconnecting…'));
stream.room.on('reconnected', () => hideBanner());

The one thing to plan for: token expiry

On the web, each reconnect presents the same RTC token the person joined with: LiveStream from @livqeno/live doesn't take a refreshToken yet. On React Native, LivqenoLiveStream does (pass refreshToken in its options, returning a fresh token for the same stream and identity), and the rest of this section only applies when you leave it out.

The RTC token inside a live-stream credential lasts 10 minutes by default (stock configuration). So:

  • A host who drops within the token's lifetime reconnects on their own.
  • A host who drops after it has expired, say 40 minutes into a one-hour stream, can't reconnect with it. The server refuses the expired token, and the SDK eventually gives up with CONNECTION_FAILED.

Common mistakes

MistakeWhat you'll seeFix
No reconnect UIUsers think the app froze when video stops.Show a banner on reconnecting.
Reusing the old credential after a failureTOKEN_EXPIRED again.Always ask your backend for fresh credentials.
Ending the stream when a host dropsThe stream can't be restarted.Wait for the host to rejoin. Only call end() when the event is really over.

Next steps