https://github.com/Eyevinn/node-webrtc
WebRTC util modules for NodeJS
https://github.com/Eyevinn/node-webrtc
library
Last synced: 12 months ago
JSON representation
WebRTC util modules for NodeJS
- Host: GitHub
- URL: https://github.com/Eyevinn/node-webrtc
- Owner: Eyevinn
- License: mit
- Created: 2020-07-10T08:25:45.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-07-10T08:45:59.000Z (almost 6 years ago)
- Last Synced: 2024-11-09T10:40:38.559Z (over 1 year ago)
- Topics: library
- Language: JavaScript
- Homepage:
- Size: 22.5 KB
- Stars: 3
- Watchers: 9
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# WebRTC Util Modules
This library is based on the WebRTC bindings provided by [node-webrtc](https://github.com/node-webrtc/node-webrtc) and provides a set of utility modules when building WebRTC server applications in NodeJS.
## WebRTC Connection Manager
To handle the negotiation of connections between peers the WebRTC Connection Manager module included in this library can be used. This connection manager provides a REST based API for the [negotiation between peers of various audio and video codecs](https://www.tutorialspoint.com/webrtc/webrtc_session_description_protocol.htm), network topologies and other device information.
```
const { WebRTCConnectionManager } = require('@eyevinn/webrtc');
const connectionManager = new WebRTCConnectionManager({ port: 3000 });
connectionManager.register("beforeoffer", (peerConnection, next) => {
console.log("Do stuff here before offer");
next();
});
connectionManager.on("connect", connection => {
console.log("Do stuff here when a client connected");
});
connectionManager.on("close", () => {
console.log("Clean up stuff when a client disconnect");
});
connectionManager.listen();
```
See `example` for a simple example of an audio/video loopback.
The REST API in the above example is available on `localhost:3000` and the Swagger API documentation on `http://localhost:3000/api/docs`.
# LICENSE
MIT