https://github.com/medooze/rtmp-server-node
RTMP server for node
https://github.com/medooze/rtmp-server-node
Last synced: 8 months ago
JSON representation
RTMP server for node
- Host: GitHub
- URL: https://github.com/medooze/rtmp-server-node
- Owner: medooze
- License: mit
- Created: 2019-02-15T10:06:24.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2024-05-22T06:47:30.000Z (over 1 year ago)
- Last Synced: 2024-05-23T03:52:07.366Z (over 1 year ago)
- Language: C++
- Size: 672 KB
- Stars: 25
- Watchers: 10
- Forks: 8
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
[](https://github.com/medooze/rtmp-server-node/actions/workflows/release.yaml)
# rtmp-server-node
RTMP server for node
## Install
Just add the Medooze media server as a dependency to your node proyect:
```
npm i --save rtmp-media-server
```
## Example
```
const brige = RTMPServer.createIncomingStreamBridge();
const demo = RTMPServer.createApplication();
const rtmp = RTMPServer.createServer();
rtmp.addApplication("demo",demo);
rtmp.start(1935);
demo.on("connect",(client)=>{
console.log("connected on "+client.getAppName());
client.on("stream",(stream)=>{
console.log("got stream ",stream.getId());
stream.on("cmd",(cmd,...params)=>{
console.log("got cmd "+cmd.name,params);
if (cmd.name=="publish")
{
try {
//Start publishing
stream.attachTo(brige);
///Started
stream.sendStatus(RTMPServer.NetStream.Publish.Start);
} catch (e) {
//Log it
console.error(e);
//Errror
stream.sendStatus(RTMPServer.NetStream.Failed,e.toString());
}
}
});
stream.on("stopped",()=>{
console.log("stream stopped");
});
});
client.accept();
});
```
## Author
Sergio Garcia Murillo @ Medooze
## Contributing
To get started, [Sign the Contributor License Agreement](https://www.clahub.com/agreements/medooze/media-server-node").
## License
MIT