• Stars
    star
    1,047
  • Rank 44,020 (Top 0.9 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 7 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

mediasoup official demo application

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:

Parameter Type Description Default Value
roomId String Id of the room Autogenerated
displayName String Display name of your participant Autogenerated
handlerName String Handler name of the mediasoup-client Device instance Autodetected
forceTcp Boolean Force RTC (audio/video/datachannel) over TCP instead of UDP false
produce Boolean Enable sending of audio/video true
consume Boolean Enable reception of audio/video true
datachannel Boolean Enable DataChannels true
forceVP8 Boolean Force VP8 codec for webcam and screen sharing false
forceH264 Boolean Force H264 codec for webcam and screen sharing false
forceVP9 Boolean Force VP9 codec for webcam and screen sharing false
enableWebcamLayers Boolean Enable simulcast or SVC for webcam true
enableSharingLayers Boolean Enable simulcast or SVC for screen sharing true
webcamScalabilityMode String scalabilityMode for webcam 'L1T3' for VP8/H264 (in each simculast encoding), 'L3T3_KEY' for VP9
sharingScalabilityMode String scalabilityMode for screen sharing 'L1T3' for VP8/H264 (in each simculast encoding), 'L3T3' for VP9
numSimulcastStreams Number Number of streams for simulcast in webcam and screen sharing 3
info Boolean Display detailed information about media transmission false
faceDetection Boolean Run face detection false
externalVideo Boolean Send an external video instead of local webcam false
e2eKey String Key for media E2E encryption/decryption (just works with some OUPS and VP8 codecs)
consumerReplicas Number Create artificial replicas of yourself and receive their audio and video (not displayed in the UI) 0

Installation

  • Clone the project:
$ git clone https://github.com/versatica/mediasoup-demo.git
$ cd mediasoup-demo
$ git checkout v3
  • Ensure you have installed the dependencies required by mediasoup to build.

  • Set up the mediasoup-demo server:

$ cd server
$ npm install
  • Copy config.example.js as config.js and customize it for your scenario:
$ 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.

  • Set up the mediasoup-demo browser app:
$ cd app
# For node 16
$ npm install
# For node 18, use legacy peer dependencies
$ npm install --legacy-peer-deps  

Run it locally

  • Run the Node.js server application in a terminal:
$ cd server
$ npm start
  • In a different terminal build and run the browser application:
$ 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.

  • Enjoy.

Deploy it in a server

  • Globally install gulp-cli NPM module (may need sudo):
$ npm install -g gulp-cli
  • Build the production ready browser application:
$ cd app
$ gulp dist
  • Upload the entire server folder to your server and make your web server (Apache, Nginx, etc) expose the server/public folder.

  • Edit your server/config.js with appropriate settings (listening IP/port, logging options, valid TLS certificate, etc).

  • Within your server, run the Node.js application by setting the DEBUG environment variable according to your needs (more info):

$ DEBUG="*mediasoup* *ERROR* *WARN*" node server.js
  • If you wish to run it as daemon/service you can use pm2 process manager. Or you can dockerize it among other options.

  • The Node.js application exposes an interactive terminal. When running as daemon (in background) the host administrator can connect to it by entering into the server folder and running:

$ 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

  • Make sure https.listenIp is set to 0.0.0.0.
  • Make sure TLS certificates reside in server/certs directory with names fullchain.pem and privkey.pem.
  • The default mediasoup port range is just 2000-2020, which is not suitable for production. You should increase it, however you should then run the container in network="host" mode.

Authors

License

MIT

More Repositories

1

mediasoup

Cutting Edge WebRTC Video Conferencing
C++
6,232
star
2

JsSIP

JsSIP, the JavaScript SIP library
JavaScript
2,384
star
3

mediasoup-client

mediasoup client side JavaScript library
TypeScript
574
star
4

OverSIP

OverSIP: the SIP framework you dreamed about
C
342
star
5

libmediasoupclient

mediasoup client side C++ library
C++
286
star
6

protoo

Minimalist and extensible Node.js signaling framework for multi-party Real-Time applications
JavaScript
168
star
7

mediasoup-broadcaster-demo

mediasoup broadcaster demo (libmediasoupclient)
C++
104
star
8

tryit-jssip

New tryit-jssip application
JavaScript
88
star
9

mediasoup-client-aiortc

mediasoup-client handler for aiortc Python library
TypeScript
53
star
10

h264-profile-level-id

Utility to process H264 profile-level-id values
TypeScript
50
star
11

mediasoup-sdp-bridge

Node.js library to allow integration of SDP based clients with mediasoup
JavaScript
41
star
12

rtp.js

RTP stack for Node and browser written in TypeScript
TypeScript
39
star
13

awaitqueue

JavaScript utility to enqueue async tasks for Node.js and the browser
TypeScript
32
star
14

RetroRTC

WebRTC made retro.
JavaScript
22
star
15

jssip-node-websocket

JsSIP.Socket interface for the Node.js based on the websocket module
JavaScript
18
star
16

pick-port

Get a free TCP or UDP port for the given IP address
TypeScript
14
star
17

mediasoup-website

Website of mediasoup
SCSS
14
star
18

jssip.net

JsSIP website
JavaScript
9
star
19

oversip-mod-mysql

A MySQL connector module for OverSIP
Ruby
6
star
20

oversip-mod-postgresql

A PostgreSQL connector module for OverSIP
Ruby
5
star
21

TrendCalculator

An algorithm to ease off decreasing values based on a constant factor, an elapsed time and (probably) also on currently highest value seen
C++
1
star