Registry / http-networking / medooze-media-server

medooze-media-server

JSON →
library1.156.2jsnpmunverified

The Medooze Media Server for Node.js (`medooze-media-server`) is a comprehensive WebRTC media server designed to receive, send, and route media streams between remote WebRTC peers. It functions as a Selective Forwarding Unit (SFU) and provides extensive support for key WebRTC features including MP4 multitrack recording (supporting H264, VP8, VP9, OPUS, PCMU/A codecs), VP9 SVC, Simulcast with temporal layer selection, RTP transport wide congestion control, sender-side bitrate estimation, NACK and RTX, Bundle, ICE lite, and Frame Marking. The current stable version is 1.156.2, indicating a project with continuous development and frequent updates. A core differentiator is its focus on robust, low-latency WebRTC SFU capabilities, detailed integration with Perfetto for tracing, and broad platform support including Linux, macOS, and Raspberry Pi, making it adaptable for various deployment environments from cloud infrastructure to edge devices. It relies on a critical peer dependency, `medooze-media-server-src`, for its underlying native components.

npm install medooze-media-server
INSTALL
IMPORT
SIG · MEDOOZE-MEDIA-SERV
M
medooze-media-server
http-networkingjavascriptv1.156.2
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

MediaServer
import MediaServer from 'medooze-media-server';
import { MediaServer } from 'medooze-media-server';
The primary `MediaServer` class/object is exported as a default export for ESM. Using a named import will result in `undefined` or a module error due to how the module is structured.
MediaServer (CJS)
const MediaServer = require('medooze-media-server');
CommonJS `require` directly obtains the `MediaServer` object, consistent with the package's documented usage pattern.
IceCandidate
import type { IceCandidate } from 'medooze-media-server';
Specific types such as `IceCandidate` are exported and can be imported using TypeScript's `import type` syntax for compile-time type safety without importing runtime values.

This quickstart demonstrates how to initialize the Medooze Media Server, create an endpoint for a WebRTC peer, configure basic logging, handle local ICE candidate generation, and generate an SDP offer to initiate a WebRTC connection. It outlines the foundational steps required before full media routing.

import MediaServer from 'medooze-media-server'; // Enable verbose logging for easier debugging and monitoring MediaServer.enableLog(true); MediaServer.logLevel = MediaServer.INFO; // Can be set to MediaServer.DEBUG for more detailed logs console.log('Starting Medooze Media Server...'); // Create a new media server instance. This is the entry point for all media operations. const mediaServer = new MediaServer(); // Create an endpoint, which represents a connection to a WebRTC peer (e.g., a browser client). // The IP should typically be your server's public IP address, but '127.0.0.1' works for local testing. // The port will be dynamically assigned if not specified, but a fixed range is often useful for firewall configuration. const endpoint = mediaServer.createEndpoint({ ip: '127.0.0.1', port: 50000 + Math.floor(Math.random() * 1000) // Assigns a random port within a common ephemeral range }); console.log(`Endpoint created with local ICE IP: ${endpoint.getLocalICE().ip}, Port: ${endpoint.getLocalICE().port}`); // Event listener for local ICE candidates generated by the endpoint. // These candidates must be sent to the remote WebRTC peer via your signaling channel. endpoint.onicecandidate = (candidate) => { console.log('Generated local ICE candidate:', candidate); // In a real application, you would send this 'candidate' object // to the remote browser client using your chosen signaling mechanism (e.g., WebSockets, MQTT, HTTP). // Example: ws.send(JSON.stringify({ type: 'iceCandidate', candidate })); }; // In a full application, you would also receive remote ICE candidates via signaling // and add them to the endpoint using: endpoint.addRemoteCandidate(remoteCandidate); // Create a WebRTC transport for the endpoint. This handles the SDP offer/answer negotiation and media flow. const transport = endpoint.createTransport({ dtls: true, // DTLS is essential for WebRTC security srtp: true, // SRTP encrypts media rtcpmux: true // RTCP-muxing combines RTP and RTCP on a single port }); // Generate a local SDP offer that needs to be sent to the remote peer. const offer = transport.createOffer(); console.log('Generated local SDP Offer:\n', offer.sdp); // Send 'offer.sdp' to the remote peer (browser) via your signaling channel. // Example of how you would set the remote peer's SDP answer (received via signaling): /* const remoteSdpAnswer = { type: 'answer', sdp: 'v=0\r\no=...\r\n...' // The SDP answer string received from the remote WebRTC peer }; transport.setRemoteProperties(remoteSdpAnswer); */ // Keep the Node.js process alive indefinitely for the media server to operate continuously setInterval(() => {}, 1000 * 60 * 60);
Debug
Known issues
breakingThe package includes native C/C++ components that require compilation during installation. This means `npm install` might fail if required build tools (like `gcc`, `g++`, `make`, `python`) are not present on the system where the installation occurs.
fix
Ensure that your system has the necessary build tools installed. For Debian/Ubuntu, `sudo apt-get install build-essential python3`. For macOS, install Xcode Command Line Tools (`xcode-select --install`). If pre-compiled binaries are desired, follow the 'Distribution' steps in the README to `npm run-script dist` and install the generated `.tgz`.
affects: >=1.0.0
gotchaThe `medooze-media-server-src` package is listed as a peer dependency but is fundamentally required for the native components of `medooze-media-server`. Failing to install it, or having a version mismatch, will prevent the server from functioning correctly.
fix
Manually ensure `medooze-media-server-src` is installed in your project: `npm install medooze-media-server-src`. Always verify that its version satisfies the `peerDependencies` range specified by `medooze-media-server`.
affects: >=1.0.0
gotchaMedooze Media Server officially supports Linux, macOS, and Raspberry Pi. While it might compile on other UNIX-like systems, Windows is explicitly not listed as supported, and users may encounter significant compilation or runtime issues on Windows environments.
fix
Deploy the media server on a supported operating system (Linux, macOS, Raspberry Pi). For development on Windows, consider using Windows Subsystem for Linux (WSL) or a virtual machine running a supported OS.
affects: >=1.0.0
gotchaThe primary `MediaServer` object is exported as a default export in ESM. Attempting to use a named import (`import { MediaServer } from 'medooze-media-server';`) will result in `MediaServer` being `undefined` or an import error, leading to runtime failures.
fix
Always use the default import syntax for ESM: `import MediaServer from 'medooze-media-server';`.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'medooze-media-server-src'
The essential native source package `medooze-media-server-src` was not installed or could not be located by the main package.
fix
Run `npm install medooze-media-server-src` in your project directory to install the peer dependency. Ensure its version is compatible with `medooze-media-server`.
Error: Failed to load NAPI-RS native module... /path/to/node_modules/medooze-media-server/build/Release/medooze-media-server.node: undefined symbol: _ZN6Medooze11MediaServerC1Ev (or similar native module loading error)
The native module failed to compile correctly during installation or is incompatible with your current Node.js version, operating system, or installed build tools.
fix
Ensure build tools are installed (e.g., `build-essential` on Linux, Xcode Command Line Tools on macOS). Try cleaning the npm cache and rebuilding the package: `npm cache clean --force` then `npm rebuild medooze-media-server`. Verify Node.js version compatibility listed in the package's documentation.
TypeError: Cannot read properties of undefined (reading 'createEndpoint')
The `MediaServer` object was not correctly imported or initialized, often due to incorrect ESM import syntax, leading to attempts to call methods on an undefined object.
fix
For ESM, ensure you use the default import syntax: `import MediaServer from 'medooze-media-server';`. For CommonJS, use `const MediaServer = require('medooze-media-server');`.
Upgrade
Version history
1.156.2latest on npm
Audit
Dependencies
medooze-media-server-srcrequiredRequired for compiling the native C/C++ media server components. Although listed as a peer dependency, it is essential for the package's functionality and native code compilation.
Agent activity
17 hits · last 30 days
node
14
OpenAI (training)
1
Resources
medooze-media-server — npm install medooze-media-server · libregistry