Home

Awesome

mediasoup-demo v3

A demo application of mediasoup v3.

Try it online at https://v3demo.mediasoup.org

Resources

Configuration via query parameters

By adding query parameters into the URL you can set certain settings of the application:

ParameterTypeDescriptionDefault Value
roomIdStringId of the roomAutogenerated
displayNameStringDisplay name of your participantAutogenerated
handlerNameStringHandler name of the mediasoup-client Device instanceAutodetected
forceTcpBooleanForce RTC (audio/video/datachannel) over TCP instead of UDPfalse
produceBooleanEnable sending of audio/videotrue
consumeBooleanEnable reception of audio/videotrue
datachannelBooleanEnable DataChannelstrue
forceVP8BooleanForce VP8 codec for webcam and screen sharingfalse
forceH264BooleanForce H264 codec for webcam and screen sharingfalse
forceVP9BooleanForce VP9 codec for webcam and screen sharingfalse
enableWebcamLayersBooleanEnable simulcast or SVC for webcamtrue
enableSharingLayersBooleanEnable simulcast or SVC for screen sharingtrue
webcamScalabilityModeStringscalabilityMode for webcam'L1T3' for VP8/H264 (in each simulcast encoding), 'L3T3_KEY' for VP9
sharingScalabilityModeStringscalabilityMode for screen sharing'L1T3' for VP8/H264 (in each simulcast encoding), 'L3T3' for VP9
numSimulcastStreamsNumberNumber of streams for simulcast in webcam and screen sharing3
infoBooleanDisplay detailed information about media transmissionfalse
faceDetectionBooleanRun face detectionfalse
externalVideoBooleanSend an external video instead of local webcamfalse
e2eKeyStringKey for media E2E encryption/decryption (just works with some OPUS and VP8 codecs)
consumerReplicasNumberCreate artificial replicas of yourself and receive their audio and video (not displayed in the UI)0

Installation

$ git clone https://github.com/versatica/mediasoup-demo.git
$ cd mediasoup-demo
$ git checkout v3
$ cd server
$ npm install
$ cp config.example.js config.js

NOTE: To be perfectly clear, "customize it for your scenario" is not something "optional". If you don't set proper values in config.js the application won't work. You must configure a tls certificate.

$ cd app
# For node 16
$ npm install
# For node 18 or higher, use legacy peer dependencies
$ npm install --legacy-peer-deps

Run it locally

$ cd server
$ npm start
$ cd app
$ npm start

If you configured a self-signed tls certificate, and receive wss: connection errors, open the wss: url with https: protocol to accept the cert and allow wss: connections in your browser.

Deploy it in a server

$ npm install -g gulp-cli
$ cd app
$ gulp dist
$ DEBUG="*mediasoup* *ERROR* *WARN*" node server.js
$ npm run connect

Run mediasoup server with Docker

$ cd server
$ docker/build.sh
$ MEDIASOUP_ANNOUNCED_IP=192.168.1.34 ./docker/run.sh

Considerations for config.js

Authors

License

MIT