TypeScript / JavaScript
Building Web Applications
Section titled “Building Web Applications”A significant feature of MoQ is that it is available on web browsers using WebTransport. This allows for real-time media streaming directly in the browser without the need for additional plugins or software. We provide a JavaScript client library to facilitate this integration.
Prerequisites
Section titled “Prerequisites”- A runtime with WebTransport support — a modern browser, or Deno
- A package manager that can install from JSR:
deno,npm,pnpm,yarn, orbun
-
Install module
The client library is published to JSR as
@qumo/moq.Terminal window deno add jsr:@qumo/moqTerminal window npx jsr add @qumo/moqTerminal window pnpm dlx jsr add @qumo/moqTerminal window yarn dlx jsr add @qumo/moqTerminal window bunx jsr add @qumo/moq -
Importing modules
import { connect } from "@qumo/moq";const session = await connect("https://localhost:4443/moq");// subscribe resolves to a [value, error] tuple — always check the error// before using the reader.const [reader, err] = await session.subscribe("/broadcast", "video");if (err !== undefined) {throw err;}// reader is a TrackReader here.Entrypoint Description @qumo/moqCore MoQ client — sessions, tracks, groups, and frames. @qumo/moq/msfMSF streaming format — catalogs, deltas, and timelines.