@moq/hang
Core media library for Media over QUIC, built on top of @moq/lite. Provides shared primitives used by @moq/watch and @moq/publish.
Overview
@moq/hang provides:
- Catalog - JSON track describing other tracks and their codec properties (audio, video, chat, location, etc.)
- Container - Media framing in two formats: CMAF (fMP4) and Legacy (varint-timestamp + raw codec bitstream)
- Support - Browser capability detection and
<hang-support>Web Component - Utilities - Hex encoding, Opus audio polyfill (libav), latency computation, browser detection workarounds
Installation
bash
bun add @moq/hang
# or
npm add @moq/hang
pnpm add @moq/hangWeb Component
<hang-support>
Display browser support information:
html
<script type="module">
import "@moq/hang/support/element";
</script>
<hang-support mode="publish" show="partial"></hang-support>JavaScript API
typescript
import * as Hang from "@moq/hang";
// Catalog — describes tracks and their codec properties
import * as Catalog from "@moq/hang/catalog";
// Container — media framing (CMAF and Legacy formats)
import * as Container from "@moq/hang/container";
// CMAF (fMP4) and Legacy (varint-timestamp + raw bitstream) are both available:
// Container.Cmaf — createVideoInitSegment, createAudioInitSegment, encodeDataSegment, decodeDataSegment, etc.
// Container.Legacy — Producer / Consumer classesFor watching and publishing, use the dedicated packages:
typescript
import * as Watch from "@moq/watch";
import * as Publish from "@moq/publish";Related Packages
- @moq/watch — Subscribe to and render MoQ broadcasts
- @moq/publish — Publish media to MoQ broadcasts
- @moq/ui-core — Shared UI components
- @moq/lite — Core pub/sub transport protocol
- @moq/signals — Reactive signals library
Protocol Specification
See the hang specification.
Next Steps
- Learn about watching streams
- Learn about publishing streams
- Use Web Components
- Use @moq/lite for custom protocols
- View code examples