Skip to content
TypeScript / JavaScript

TypeScript / JavaScript

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

  • A runtime with WebTransport support — a modern browser, or Deno
  • A package manager that can install from JSR: deno, npm, pnpm, yarn, or bun

Install module

The client library is published to JSR as @qumo/moq.

deno add jsr:@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.
EntrypointDescription
@qumo/moqCore MoQ client — sessions, tracks, groups, and frames.
@qumo/moq/msfMSF streaming format — catalogs, deltas, and timelines.

Note: Browser compatibility

If your browser does not support WebTransport, moqt does not work. Check the Can I Use for the latest compatibility information.