Node.js bindings for libwebrtc
, which implements WebRTC M96. This project aims for spec-compliance and is tested using the W3C's web-platform-tests project. A number of nonstandard APIs for testing are also included.
npm install @cubicleai/wrtc
Installing from NPM downloads a prebuilt binary for your operating system × architecture. Set the TARGET_ARCH
environment variable to "arm" or "arm64" to download for armv7l or arm64, respectively. Linux and macOS users can also set the DEBUG
environment variable to download debug builds.
You can also build from source.
We intend to officially support
- the latest 3 stable versions of Node.js
- the latest 3 stable releases of Electron
For the following platforms:
- Linux
- macOS
- Windows
On the following architectures:
- x64
- arm64
- armv7l
Build validation is not yet in place for all of these platforms.
The following platforms are confirmed to work with @cubicleai/wrtc
. Some may have prebuilt binaries available. Since we target N-API version 3, there may be additional platforms supported that are not listed here. If your platform is not supported, you may still be able to build from source.
The table below maps our support intentions to which configurations have been validated.
Linux | macOS | Windows | |||||
---|---|---|---|---|---|---|---|
armv7l | arm64 | x64 | x64 | arm64 | x64 | ||
Node.js | 14 | ✓ | ✓ | ✓ | |||
16 | ✓ | ✓ | ✓ | ||||
18 | ✓ | ✓ | ✓ | ||||
Electron | 18 | ||||||
19 | |||||||
20 |
Other libwebrtc bindings use Google's in-tree libc++
when targetting Linux. Due to compatibility issues, and to reduce the need for multiple C++ standard libraries to be loaded within a single application when using @cubicleai/wrtc
in concert with other native add-ons, we have opted to use the system's libstdc++
instead. This does mean that you will need a compatible version of libstdc++
installed when you use the prebuilt versions of the library. If the prebuilt versions give you runtime link errors related to missing versions of libstdc++
, either install the correct version or use SKIP_DOWNLOAD=true
when running npm install
to build from source instead.
See cubicleai/webrtc-examples.
Make sure to check the platform-specific sections below for important information.
To set up a working copy for development:
Pre-steps
- Install
python3
, C/C++ toolchain (iebuild-essential
),cmake
export SKIP_DOWNLOAD=true # Important to skip fetching a prebuilt version from CDN
export DEBUG=1
export PARALLELISM=24 # Set to number of logical cores on your machine
# Initial install will build libwebrtc
# Get a coffee.
npm install
Pre-steps:
- Install python3
- Make sure long path support is enabled
- Set
HKLM\SYSTEM\CurrentControlSet\Control\FileSystem\LongPathsEnable
to1
git config --global core.longpaths true
git config core.longpaths true
- Set
- Install VS 2019 (not just the VS 2019 build tools from a newer VS release like 2022)
libwebrtc
is the limiting factor here
- Install Windows 10 SDK v10.0.19041.0
- Use the Windows SDK installer, make sure to include the required Debugging Tools for Windows
- (!!) Do not use the Visual Studio installer, if you have previously installed this SDK via Visual Studio Installer, you must first remove it and install using the Windows SDK installer instead. If you use this, the build will fail on requirement of Windows SDK 10.0.19041.0
Initial build
$env:SKIP_DOWNLOAD = 'true' # Important to skip fetching a prebuilt version from CDN
$env:DEBUG = '1'
$env:PARALLELISM = '24' # set to number of logical cores
# Initial install will build libwebrtc
# Get a coffee.
npm install
References
- RTP: A Transport Protocol for Real-Time Applications (IETF RFC 3550)
- Unified Plan
- Plan B
- RTCRtpTransceiver (MDN)
- Negotiating Media Multiplexing Using the Session Description Protocol ("BUNDLE" IETF I-D)
Editorial
- The evolution of WebRTC 1.0. (Mozilla)
- Exploring RTCRtpTransceiver. (Mozilla)
- Webrtc with transceivers (nterreri)