Skip to content
/ wrtc Public
forked from cubicleai/wrtc

Node.js bindings for WebRTC

License

Notifications You must be signed in to change notification settings

dxos/wrtc

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@cubicleai/wrtc

NPM

Node.js bindings for libwebrtc, which implements WebRTC M95. 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.

Install

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.

Supported Platforms

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

Platform-specific details

Linux

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.

Examples

See cubicleai/webrtc-examples.

Development

Make sure to check the platform-specific sections below for important information.

To set up a working copy for development:

Linux/Mac

Pre-steps

  • Install python3, C/C++ toolchain (ie build-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

Windows

Pre-steps:

  • Install python3
  • Make sure long path support is enabled
    • Set HKLM\SYSTEM\CurrentControlSet\Control\FileSystem\LongPathsEnable to 1
    • git config --global core.longpaths true
    • git config core.longpaths true
  • 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

Required Reading

References

Editorial

Packages

No packages published

Languages

  • C++ 65.5%
  • TypeScript 21.8%
  • CMake 7.0%
  • JavaScript 2.5%
  • C 2.5%
  • Batchfile 0.4%
  • Other 0.3%