Nearglass

Introduction

Live video at the delay of a video call, to thousands of viewers, in one browser tag.

Nearglass carries live video from your source to your viewers with the delay of a video call, not of a broadcast. You send video from OBS, an encoder or your own device; your viewers watch in a web page or a native app; we run the relays in between.

What you build with it

  • A live event where seconds matter. An auction, a race, a live sale: every viewer sees the moment at the same time, close enough to the source that a bid or a bet lands on what is really happening.
  • A machine people drive over the web. One driver at a time sends commands back through the same relays while everyone else watches (Controller seats).
  • A shared screen or camera inside your own app. The same stream plays in a web page and in a native Windows app.

How it fits together

your encoder or device --SRT, RTMP, WHIP or the SDK--> ingest --MoQ--> relays --MoQ--> players
                                                                         |
your backend --secret key--> control API --tokens--------------------------+
your page --publishable key--^              (streams, seats, usage, webhooks)
  • Publishers send one stream: OBS or any encoder over SRT, RTMP or WHIP, ffmpeg, the nearglass command line tool, or your own device with the SDK library.
  • Relays fan the stream out over MoQ (Media over QUIC). A viewer joins the nearest one.
  • Players play it: the <nearglass-player> element in any page, @nearglass/react in a React app, or the C library in a native app. Browsers that cannot play MoQ (Safari, iPhone) fall back to LL-HLS by themselves.
  • The control API is where your backend creates streams, hands out seats with short-lived tokens, and reads usage. It is the only part your code talks to directly.

The ideas behind it (streams, keys, seats and tokens, the viewer cap, metering, the fallback) are in Concepts.

Start here

Quickstarta stream playing in a web page, from nothing, with packages only
Conceptsthe few ideas the API, the player and the publishers are built on
PublishOBS, SRT, RTMP, WHIP, ffmpeg, the native encoder, a device, audio
Playthe web player, React, a native Windows app, phones and Safari
Secureviewer and publisher tokens, renewal, admission and caps
Operateusage and spending caps, webhooks, monitoring, self-hosting, regions
Referencethe control API, the player, the CLI, config files, error codes

What is in the box

PackageWhat it is
@nearglass/playerthe browser player: plain ES modules, no dependencies, no build step
@nearglass/reacta React component around the player
nearglassthe command line tool: publish a file, run an ingest gateway, mint tokens
nearglass-ffithe C library (nearglass.h) for publishing from a device and playing in a native app
nearglass-relaythe relay, as a Debian package, for running your own

On this page