1. Prepare
First, find a linux server, recommended for Ubuntu, install the latest version of NodeJS and NPM, installation method, see the "Installing the latest version NodeJS and NPM" article.
Installation and deployment process need to download the source code on GitHub, so the need to install git, use the following command to install git
sudo apt-get install git -y
2. Install Mediasoup
Use the following command to install mediasoup
sudo npm install mediasoup
3. Installation Mediasoup-client
Use the following command to install mediasoup-client
sudo npm install mediasoup-client
4. Installation Mediasoup-demo
4.1 Download Source
Clones with the command on the source GitHub
git clone https://github.com/versatica/mediasoup-demo.git
4.2 Installation Configuration Server
Directory into the Server
cd mediasoup-demo/server
Installation Server
npm install
Copy config.example.js
rename config.js
, and you can customize settings
cp config.example.js config.js
4.3 install the browser App
Into the browser app directory
cd mediasoup-demo/app
Install the browser APP
npm install
Global installation gulp-cli
(may need to use sudo
):
npm install -g gulp-cli
5. Run Mediasoup Demo Project
1, first of all, open a terminal, run server:
cd mediasoup-demo/server
node server.js
2, in another terminal open start app:
cd mediasoup-demo/app
gulp live
3, can then browse the browser, as shown below, two browsers accessing the same room
https://172.16.72.147:3000/?roomId=gvuxkens , wherein:
- https://172.16.72.147:3000/ is Mediasoup Demo program access address
- gvuxkens id number for the conference room
4, the parameters can be set via the URL, and the URL parameter related to the chart below:
parameter | Explanation |
---|---|
roomId | Conference room ID, an arbitrary string |
displayName | Current user nickname, an arbitrary string |
I pEndpoint | Whether the SIP terminal, true- is, false- No, default false |
simulcast | Whether to open Simulcast, true- Shi, false- No, default true |
forceTcp | Whether to force the use of TCP, true- Shi, false- No, default false |
spy | Whether spy, true- Shi, false- No, default false |
forceH264 | Whether to force the current terminal use H264 coding, true- Shi, false- No, default false |
For example: Open the following addresses can be set below
- The current terminal into the conference room ID is: 123456
- The current terminal nickname: cgs
- The current terminal opened Simulcast
- H264 encoded using the current terminal (default is VPx encoding)
https://172.16.72.147:3000/?roomId=123456&displayName=cgs&simulcast=true&forceH264=true
6. Run results
The red block out audio format used by the terminal, the video format and video resolution information
( note: since a Simulcast function, different decoding capabilities of the terminal, sent and received video resolution there is a difference )
6.1 conference two terminals
Effect seen on the terminal 80125
Effect seen on the terminal 80240
6.2 three conference terminal
Effect of three terminals, as shown in FIG.
7. References
Multiparty calls based research mediasoup of
https://blog.csdn.net/gupar/article/details/83788934
8. Appendix
Mediasoup official Demo
https://github.com/versatica/mediasoup-demo.git
Mediasoup broadcast example
https://github.com/michaelfig/mediasoup-broadcast-example.git
Mediasoup simple example
https://github.com/footniko/mediasoup-sample.git