AI prompts
base on Rust library for Media over QUIC 
[](https://discord.gg/FCYF3p99mr)
<p align="center">
<img height="128px" src="https://github.com/kixelated/moq/blob/main/.github/logo.svg" alt="Media over QUIC">
</p>
Media over QUIC (MoQ) is a live (media) delivery protocol utilizing QUIC.
It utilizes new browser technologies such as [WebTransport](https://developer.mozilla.org/en-US/docs/Web/API/WebTransport_API) and [WebCodecs](https://developer.mozilla.org/en-US/docs/Web/API/WebCodecs_API) to provide WebRTC-like functionality.
Despite the focus on media, the transport is generic and designed to scale to enormous viewership via clustered relay servers (aka a CDN).
See [quic.video](https://quic.video) for more information.
**Note:** this project is a [fork](https://quic.video/blog/transfork) of the [IETF specification](https://datatracker.ietf.org/group/moq/documents/).
The principles are the same but the implementation is exponentially simpler given a narrower focus (and no politics).
## Quick Start
Too many words, here's a quick start:
**Requirements:**
- [Rustup](https://www.rust-lang.org/tools/install)
- [Just](https://github.com/casey/just?tab=readme-ov-file#installation)
- [Node + NPM](https://nodejs.org/)
```sh
just setup
just all
```
Or if you're feeling superior, you can use the [Nix](https://nixos.org/download.html) [Flake](https://nixos.wiki/wiki/Flakes) instead:
```sh
nix develop --command just all
```
## Design
For the non-vibe coders, let's talk about how the protocol works.
Unlike WebRTC, MoQ is purposely split into multiple layers to allow for maximum flexibility:
- **QUIC**: The network layer, providing a semi-reliable transport over UDP.
- **WebTransport**: QUIC but with a HTTP/3 handshake for browser compatibility.
- **moq-lite**: A pub/sub protocol used to serve "broadcasts", "tracks", "groups", and "frames".
- **hang**: Media-specific encoding based on the [WebCodecs API](https://developer.mozilla.org/en-US/docs/Web/API/WebCodecs_API). It's designed primarily for real-time conferencing.
- **application**: Any stuff you want to build on top of moq/hang.
For more information, check out [the blog](https://quic.video/blog/moq-onion).
If you're extra curious, check out the [specification](https://github.com/kixelated/moq-drafts).
If you want to make changes (or argue about anything), ping `@kixelated` on [Discord](https://discord.gg/FCYF3p99mr).
## Languages
This repository is split based on the language and environment:
- [rs](rs): Rust libraries for native platforms. (and WASM)
- [js](js): Typescript libraries for web only. (not node)
Unfortunately, this means that there are two implementations of `moq` and `hang`.
They use the same concepts and have a similar API but of course there are language differences.
Originally, this repository was called `moq-rs` with the aim of using Rust to target all platforms.
Unfortunately, it turns out that much of the code is platform specific, so it resulted in a tiny Rust core and a lot of convoluted wrappers.
For example, a MoQ web player MUST use browser APIs for networking, encoding, decoding, rendering, capture, etc.
The web is a sandbox, and with no low level hardware access we have to jump through the APIs designed for Javascript.
[wasm-bindgen](https://rustwasm.github.io/wasm-bindgen/) and [web-sys](https://rustwasm.github.io/wasm-bindgen/api/web_sys/) help, and you can see an example in [hang-wasm](rs/hang-wasm), but it's a lot of boilerplate and language juggling for little gain.
Anyway, enough ranting, let's get to the code.
### Rust (Native)
- [moq](https://docs.rs/moq-lite): The underlying pub/sub protocol providing real-time latency and scale. This is a simplified fork of the IETF [moq-transport draft](https://datatracker.ietf.org/doc/draft-ietf-moq-transport/) called `moq-lite`.
- [moq-relay](rs/moq-relay): A server that forwards content from publishers to any interested subscribers. It can be clustered, allowing multiple servers to be run (around the world!) that will proxy content to each other.
- [moq-clock](rs/moq-clock): A dumb clock client/server just to prove MoQ can be used for more than media.
- [moq-native](rs/moq-native): Helpers to configure QUIC on native platforms.
- [hang](https://docs.rs/hang): Media-specific components built on top of MoQ.
- [hang-cli](rs/hang-cli): A CLI for publishing and subscribing to media.
- [hang-gst](rs/hang-gst): A gstreamer plugin for publishing and subscribing to media.
- [web-transport](https://github.com/kixelated/web-transport-rs): A Rust implementation of the WebTransport API powered by [Quinn](https://github.com/quinn-rs/quinn).
The [hang-wasm](rs/hang-wasm) crate is currently unmaintained and depends on some other unmaintained crates. Notably:
- [web-transport-wasm](https://github.com/kixelated/web-transport-rs/tree/main/web-transport-wasm): A wrapper around the WebTransport API.
- [web-codecs](https://docs.rs/web-codecs/latest/web_codecs/): A wrapper around the WebCodecs API.
- [web-streams](https://docs.rs/web-streams/latest/web_streams/): A wrapper around the WebStreams API.
- You get the idea; it's wrappers all the way down.
### Typescript (Web)
- [@kixelated/moq](https://www.npmjs.com/package/@kixelated/moq): The underlying pub/sub protocol providing real-time latency and scale.
- [@kixelated/hang](https://www.npmjs.com/package/@kixelated/hang): Media-specific components built on top of MoQ. Can be embedded on a web page via a Web Component.
Documentation is sparse as the API is still a work in progress.
Check out the [demos](js/hang-demo) and [quic.video](https://github.com/kixelated/quic.video/blob/main/src/components/watch.tsx) for examples.
# Development
We use [just](https://github.com/casey/just) to simplify the development process.
Check out the [justfile](justfile) or run `just` to see the available commands.
## Requirements
- [Rustup](https://www.rust-lang.org/tools/install)
- [Node](https://nodejs.org/)
- [Just](https://github.com/casey/just?tab=readme-ov-file#installation)
Install any other required tools:
```sh
just setup
```
## Building
```sh
# Run the relay, a demo movie, and web server:
just all
# Or run each individually in separate terminals:
just relay
just pub bbb
just web
```
Then, visit [https://localhost:8080](localhost:8080) to watch the simple demo.
### Contributing
When you're ready to submit a PR, make sure the tests pass or face the wrath of CI.
The normal `check` command skips over `hang-gst` and `hang-wasm` to simplify setup, so you'll need the `--workspace` flag to test everything:
```sh
just check --workspace
# Optional: Automatically fix easy lint issues.
just fix --workspace
```
If CI is failing for some mysterious reason, you can use [Nix](https://nixos.org/download.html) to run pinned versions of the tools:
```sh
nix develop --command just check --workspace
```
# License
Licensed under either:
- Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
", Assign "at most 3 tags" to the expected json: {"id":"4391","tags":[]} "only from the tags list I provide: [{"id":77,"name":"3d"},{"id":89,"name":"agent"},{"id":17,"name":"ai"},{"id":54,"name":"algorithm"},{"id":24,"name":"api"},{"id":44,"name":"authentication"},{"id":3,"name":"aws"},{"id":27,"name":"backend"},{"id":60,"name":"benchmark"},{"id":72,"name":"best-practices"},{"id":39,"name":"bitcoin"},{"id":37,"name":"blockchain"},{"id":1,"name":"blog"},{"id":45,"name":"bundler"},{"id":58,"name":"cache"},{"id":21,"name":"chat"},{"id":49,"name":"cicd"},{"id":4,"name":"cli"},{"id":64,"name":"cloud-native"},{"id":48,"name":"cms"},{"id":61,"name":"compiler"},{"id":68,"name":"containerization"},{"id":92,"name":"crm"},{"id":34,"name":"data"},{"id":47,"name":"database"},{"id":8,"name":"declarative-gui "},{"id":9,"name":"deploy-tool"},{"id":53,"name":"desktop-app"},{"id":6,"name":"dev-exp-lib"},{"id":59,"name":"dev-tool"},{"id":13,"name":"ecommerce"},{"id":26,"name":"editor"},{"id":66,"name":"emulator"},{"id":62,"name":"filesystem"},{"id":80,"name":"finance"},{"id":15,"name":"firmware"},{"id":73,"name":"for-fun"},{"id":2,"name":"framework"},{"id":11,"name":"frontend"},{"id":22,"name":"game"},{"id":81,"name":"game-engine "},{"id":23,"name":"graphql"},{"id":84,"name":"gui"},{"id":91,"name":"http"},{"id":5,"name":"http-client"},{"id":51,"name":"iac"},{"id":30,"name":"ide"},{"id":78,"name":"iot"},{"id":40,"name":"json"},{"id":83,"name":"julian"},{"id":38,"name":"k8s"},{"id":31,"name":"language"},{"id":10,"name":"learning-resource"},{"id":33,"name":"lib"},{"id":41,"name":"linter"},{"id":28,"name":"lms"},{"id":16,"name":"logging"},{"id":76,"name":"low-code"},{"id":90,"name":"message-queue"},{"id":42,"name":"mobile-app"},{"id":18,"name":"monitoring"},{"id":36,"name":"networking"},{"id":7,"name":"node-version"},{"id":55,"name":"nosql"},{"id":57,"name":"observability"},{"id":46,"name":"orm"},{"id":52,"name":"os"},{"id":14,"name":"parser"},{"id":74,"name":"react"},{"id":82,"name":"real-time"},{"id":56,"name":"robot"},{"id":65,"name":"runtime"},{"id":32,"name":"sdk"},{"id":71,"name":"search"},{"id":63,"name":"secrets"},{"id":25,"name":"security"},{"id":85,"name":"server"},{"id":86,"name":"serverless"},{"id":70,"name":"storage"},{"id":75,"name":"system-design"},{"id":79,"name":"terminal"},{"id":29,"name":"testing"},{"id":12,"name":"ui"},{"id":50,"name":"ux"},{"id":88,"name":"video"},{"id":20,"name":"web-app"},{"id":35,"name":"web-server"},{"id":43,"name":"webassembly"},{"id":69,"name":"workflow"},{"id":87,"name":"yaml"}]" returns me the "expected json"