@astronautlabs/webrtc
TypeScript icon, indicating that this package has built-in type declarations

0.5.2 • Public • Published

@/webrtc

🚧 Work In Progress
This library is in an alpha state. It is not yet ready for production use.

📺 Part of the Astronaut Labs Broadcast Suite

NPM Build Status

Node.js bindings for libwebrtc, which implements WebRTC M94. 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 @astronautlabs/webrtc

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 @astronautlabs/webrtc. 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 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 @/webrtc 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 astronautlabs/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

Readme

Keywords

Package Sidebar

Install

npm i @astronautlabs/webrtc

Weekly Downloads

0

Version

0.5.2

License

BSD-2-Clause

Unpacked Size

21.4 MB

Total Files

480

Last publish

Collaborators

  • rezonant