moq-rs/README.md

64 lines
2.2 KiB
Markdown
Raw Normal View History

2022-06-29 16:30:55 +00:00
# Warp
2023-05-16 17:23:50 +00:00
Live media delivery protocol utilizing QUIC streams. See the [Warp draft](https://datatracker.ietf.org/doc/draft-lcurley-warp/).
2022-06-29 16:17:02 +00:00
2023-05-16 17:23:50 +00:00
Warp works by delivering media over independent QUIC stream. These streams are assigned a priority such that old video will arrive last and can be dropped. This avoids buffering in many cases, offering the viewer a potentially better experience.
2022-06-29 16:17:02 +00:00
2023-05-16 17:23:50 +00:00
This demo requires WebTransport and WebCodecs, which currently (May 2023) only works on Chrome.
2022-06-29 16:17:02 +00:00
2023-05-16 17:23:50 +00:00
# Development
## Easy Mode
Requires Docker *only*.
2022-06-29 16:17:02 +00:00
2023-05-16 17:23:50 +00:00
```
docker-compose up --build
```
2023-05-16 17:23:50 +00:00
Then open [https://localhost:4444/](https://localhost:4444) in a browser. You'll have to click past the TLS error, but that's the price you pay for being lazy. Follow the more in-depth instructions if you want a better development experience.
2022-06-29 16:30:55 +00:00
## Requirements
2022-06-29 16:17:02 +00:00
* Go
2023-05-16 17:23:50 +00:00
* Rust
2022-06-29 16:17:02 +00:00
* ffmpeg
* openssl
2023-05-16 17:23:50 +00:00
* Chrome
2022-06-29 16:17:02 +00:00
2022-06-29 16:30:55 +00:00
## Media
This demo simulates a live stream by reading a file from disk and sleeping based on media timestamps. Obviously you should hook this up to a real live stream to do anything useful.
2022-06-29 16:17:02 +00:00
2023-05-16 17:23:50 +00:00
Download your favorite media file and convert it to fragmented MP4:
2022-06-29 16:17:02 +00:00
```
2022-11-08 13:18:35 +00:00
wget http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4 -O media/source.mp4
2023-05-16 17:23:50 +00:00
./media/fragment
2022-06-29 16:17:02 +00:00
```
2023-05-16 17:23:50 +00:00
## Certificates
2022-06-29 16:17:02 +00:00
Unfortunately, QUIC mandates TLS and makes local development difficult.
2023-05-16 17:23:50 +00:00
If you have a valid certificate you can use it instead of self-signing.
2022-06-29 16:17:02 +00:00
Otherwise, we use [mkcert](https://github.com/FiloSottile/mkcert) to install a self-signed CA:
2022-06-29 16:17:02 +00:00
```
./generate/cert
2022-06-29 16:17:02 +00:00
```
With no arguments, the server will generate self-signed cert using this root CA. This certificate is only valid for *2 weeks* due to how WebTransport performs certificate fingerprinting.
2022-06-29 16:17:02 +00:00
2022-06-29 16:30:55 +00:00
## Server
2022-11-18 23:13:35 +00:00
The Warp server supports WebTransport, pushing media over streams once a connection has been established. A more refined implementation would load content based on the WebTransport URL or some other messaging scheme.
2022-06-29 16:17:02 +00:00
```
cd server
2023-05-16 17:23:50 +00:00
cargo run
2022-06-29 16:17:02 +00:00
```
2023-05-16 17:23:50 +00:00
This listens for WebTransport connections (not HTTP) on `https://localhost:4443` by default.
2022-11-18 23:13:35 +00:00
2023-05-16 17:23:50 +00:00
## Web
The web assets need to be hosted with a HTTPS server.
2022-06-29 16:17:02 +00:00
```
cd web
yarn install
2022-06-29 16:17:02 +00:00
yarn serve
```
2023-05-16 17:23:50 +00:00
These can be accessed on `https://localhost:4444` by default.