Skip to content

hasyakattaofficial/node-rtmp

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RTMP-Server

A Node.js implementation of RTMP Server

  • Supports only RTMP protocol.
  • Supports only H.264 video and AAC audio.

Install

npm install --save rtmp2

Usage

const RTMP = require('rtmp2');

const rtmpServer = RTMP.createServer();

rtmpServer.on('client', client => {
  client.on('command', command => {
  //  console.log(command.cmd, command);
  });

  client.on('connect', () => {
     console.log('connect', client.app);
  });
  
  client.on('play', ({ streamName }) => {
    console.log('PLAY', streamName);
  });
  
  client.on('publish', ({ streamName }) => {
    console.log('PUBLISH', streamName);
  });
  
  client.on('stop', () => {
    console.log('client disconnected');
  });
});

rtmpServer.listen(1935);

You can now publish streams to rtmp://localhost:1935/live/mytv and use any unique stream key.

~$ ffmpeg -f avfoundation -i "1" -vcodec libx264 -f flv rtmp://localhost:1935/live/mytv

The stream will then be available at rtmp://localhost:1935/live/mytv.

License

This project is under MIT license.

About

A Node.js implementation of RTMP Server

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%