mediasoup

/ home / Documentation / v3 / mediasoup / Installation

mediasoup v3 Installation

Install mediasoup via NPM within your Node.js application:

$ npm install mediasoup@3

During the installation process, the mediasoup NPM package will try to fetch a prebuilt mediasoup-worker binary appropriate for current platform and architecture. If not found, it will locally build the mediasoup-worker binary.

  • If “MEDIASOUP_SKIP_WORKER_PREBUILT_DOWNLOAD” or “MEDIASOUP_LOCAL_DEV” environment variables are set, or if mediasoup package is being installed via git+ssh (instead of via npm), and if “MEDIASOUP_FORCE_WORKER_PREBUILT_DOWNLOAD” environment variable is not set, the installation process won't attempt to fetch any prebuilt mediasoup-worker binary and it will build it locally instead.
MEDIASOUP_SKIP_WORKER_PREBUILT_DOWNLOAD="true" npm install mediasoup@3
  • If “MEDIASOUP_WORKER_BIN” environment variable is set during mediasoup package installation, mediasoup will use the the value of such an environment variable as mediasoup-worker binary and won't compile it locally. And if same environment variable is set when running your Node.js app, mediasoup will use it as mediasoup-worker binary (instead of looking for it in the mediasoup/worker/out/Release path).
MEDIASOUP_WORKER_BIN="/home/xxx/src/foo/mediasoup-worker" npm install mediasoup@3
MEDIASOUP_WORKER_BIN="/home/xxx/src/foo/mediasoup-worker" node myapp.js

Requirements

In order to build the mediasoup C/C++ components the following packages and libraries must be available in the target host:

All Platforms

Python is only required if no prebuilt mediasoup-worker binary was fetched.

Linux, OSX and *NIX Systems

  • On Debian and Ubuntu install the python3-pip DEB package, otherwise PIP package manager might be unavailable.
  • On Debian and Ubuntu install the build-essential DEB package. It includes gcc/g++.
  • On YUM based Linux (Red Hat, CentOS) use yum groupinstall "Development Tools".
  • On musl based systems (such as Alpine Linux) linux-headers package must be installed, otherwise abseil-cpp C++ subproject fails to build due to “linux/futex.h: No such file or directory”.

If there is neither python3 nor python command pointing to Python 3 executable, set the PYTHON environment variable during mediasoup installation:

$ PYTHON=python3.9 npm install mediasoup@3

If the MEDIASOUP_MAX_CORES environment variable is set, the build process will use that number of CPU cores. Otherwise, it will auto-detect the number of cores in the machine.

Windows

  • Make sure to have ISRG Root X1 certificate installed, or you will get errors while downloading OpenSSL (whose website is secured with Let's Encrypt), you can import it from https://letsencrypt.org/certs/isrgrootx1.der (install to Local computer).
  • If you have Python-related errors, search for “App execution aliases” in system settings and disable everything Python-related from there.