mediasoup 0.2.0

Cutting Edge WebRTC Video Conferencing in Rust
Documentation

Rust port of mediasoup TypeScript library!

For general information go to readme in repository.

For TypeScript users

If you were using mediasoup in TypeScript before, most of the API should be familiar to you. However, this is not one-to-one port, API was adjusted to more idiomatic Rust style leveraging powerful type system and ownership system to make API more robust and more misuse-resistant.

So you will find specific types in most places where plain strings were used, instead of close() you will see Drop implementation for major entities that will close everything gracefully when it goes out of scope.

How to start

This is very low-level library. Which means it doesn't come with a ready to use signaling mechanism or easy to customize app scaffold (see design goals).

It is recommended to visit mediasoup website and read design overview first.

Pre-requisite for using this library is to have mediasoup worker. The simples way to get it is to run npm i mediasoup (see installation instructions) and get worker binary from node_modules/mediasoup/worker/out/Release/mediasoup-worker.

If you are hacking on the library just run npm i in the root of the repo and tests will pick up the worker binary automatically.

With that in mind, you want start with creating WorkerManager instance and then 1 or more workers. Workers a responsible for low-level job of sending media and data back and forth. Each worker is backed by single-core C++ worker process. On each worker you create one or more routers that enable injection, selection and forwarding of media and data through [transport] instances. There are a few different transports available, but most likely you'll want to use WebRtcTransport most often. With transport created you can start creating Producers to send data to Router and Consumer instances to extract data from Router.

Some of the more advanced cases involve multiple routers and even workers that can user more than one core on the machine or even scale beyond single host. Check scalability page of the official documentation.

Please check integration and unit tests for usage examples, they cover all major functionality and are a good place to start until we have demo apps built in Rust).