Open Source

Everything is open source and broken into two repositories:

Rust

Native code is written in Rust and is split into a few notable crates:

cratedescription
moq-liteA generic pub/sub transport. This is a minimal reinterpretation of the IETF MoqTransport draft.
moq-relayA Moq server that connects publishers to subscribers, caching and deduplicating any subscriptions. Note that MoQ does not support P2P; instead it utilizes relays to scale out to many subscribers.
moq-clockIt’s a clock! Just to demonstrate that MoQ can be used for more than media.
hangA media specific library built on top of moq-lite. This provides a JSON “catalog” that describes the media tracks and “container” that literally consists of a timestamp. The actual media decoding/encoding is left to the platform.
hang-cliA client that integrates with ffmpeg to publish media. This pipes fMP4 over stdin, so it’s not the most efficient…
hang-gstA gstreamer plugin for publishing and consuming media. It works, but needs a lot of polish.
hang-wasmAn MoQ web client utilizing WebAssembly, WebCodecs, and WebTransport. Deprecated in favor of the Typescript implementation; see below for justification.

There are some additional crates in other repositories that might be of interest:

cratedescription
web-transport-quinnA WebTransport client and server utilizing Quinn. Copies the Quinn API and abstracts away the HTTP/3 handshake.
web-transport-wasmA WASM WebTransport wrapper around the web-sys bindings.
web-transportA common (opinionated) interface, utilizing one of the above depending on the platform. This is what the moq-lite crate uses.
web-codecsA wrapper around the WebCodecs API for WASM.
web-streamsA wrapper around the Streams API for WASM.

Typescript

Web code is written in Typescript and is split into a few packages:

packagedescription
@kixelated/moqA moq-lite client that mirrors the Rust API. You can publish and subscribe to generic tracks. Any media stuff is implemented at a higher layer.
@kixelated/hangA media library. This is where the bulk of the cool stuff happens, like capturing/encoding or decoding/rendering media. Includes Web Components to make setup super simple. See the demos.

Note: These utilize browser-specific APIs and there’s no currently no support for Node and other server runtimes. Deno is doing some cool stuff with WebTransport so maybe it’ll work there someday.

And before you ask, yes, it is possible to use WASM for web support as demonstrated by the hang-wasm crate. However, it involves a lot of boilerplate, wrappers, and casting. The performance is not great because the WASM sandbox doesn’t have networking or device access, requiring copying and/or message passing to use Web APIs.

So, we migrated all web code (back) to Typescript. It makes me a sad crab, but it results in faster iteration and the best user experience.

License

Everything is licensed under MIT or Apache-2.0 so knock yourself out.

If you do end up using MoQ for your project, let me know! I will never get tired of DMs. @kixelated on Discord.

@kixelated