iizukanao / node-rtsp-rtmp-server

RTSP/RTMP/HTTP hybrid server
MIT License
1.09k stars 282 forks source link

simple nodejs example #40

Open NicolasDe opened 8 years ago

NicolasDe commented 8 years ago

Hello there, I just started using node.js and installed node-rtsp-rtmp-server via npm. So I'm stuck with how to setup it... I have included it into my server but I'm not sure how to call and setup it.

var module_http = require('http');
var module_ecstatic = require('ecstatic');
var module_stream = require('node-rtsp-rtmp-server');

const server_port = 1313;
var server_options =
{
    root: __dirname + '/public',
    port: server_port,
    baseDir: '/',
    cache: 3600,
    showDir: true,
    showDotfiles: true,
    autoIndex: true,
    humanReadable: true,
    headers: {},
    si: false,
    defaultExt: 'html',
    gzip: false,
    serverHeader: true,
    contentType: 'application/octet-stream',
    mimeTypes: undefined,
    handleOptionsMethod: false
};

module_http.createServer(module_ecstatic(server_options)).listen(server_port);

console.log('Listening on : ' + server_port);

If anyone could help me, that would be great!

iizukanao commented 8 years ago

Sorry, see this example. https://gist.github.com/iizukanao/3b121664f03dbf87bfcf

Alternatively, you can use this npm module instead. https://www.npmjs.com/package/rtsp-rtmp-server

roysG commented 7 years ago

How can i stream a video though the nodejs?

iizukanao commented 7 years ago

@roysG There is no such API at this time, but you can serve MP4 contents by putting it in "file" directory. Please see https://github.com/iizukanao/node-rtsp-rtmp-server#serving-mp4-files-as-recorded-streams for details.