node-rtsp-stream icon indicating copy to clipboard operation
node-rtsp-stream copied to clipboard

Deploy on Heroku

Open lxtrungg opened this issue 4 years ago • 3 comments

Hello, I cannot deploy my stream server on Heroku, because it have issue with the ws Port. Heroku just allow one Port but I need 2 to (ws Port and Server Port) to play stream. Anyone can help me? Thank you so much!

lxtrungg avatar Jun 15 '20 15:06 lxtrungg

you need to create env var , let me check how they are done

rogeliozx avatar Jul 10 '20 18:07 rogeliozx

you need to create env var , let me check how they are done

Hello, this is basic code:

Server: `var express = require('express');

var app = express();

app.use(express.static('public'));

app.set('views', './views');

app.set('view engine', 'ejs');

var server = require('http').Server(app);

app.use('/camera1', (req, res) => res.render(camera1))

Stream = require('node-rtsp-stream')

stream = new Stream({

name: 'Camera1',

streamUrl: 'rtsp://....',

wsPort: 4001,

ffmpegOptions: { // options ffmpeg flags

  '-stats': '', // an option with no neccessary value uses a blank string

  '-r': 30 // options with required values specify the value after the key

}

})

server.listen(process.env.PORT || 3000);`

Client: head meta(charset='UTF-8') meta(name='viewport', content='width=device-width, initial-scale=0.64') meta(http-equiv='X-UA-Compatible', content='ie=edge') title Surveillance Camera canvas#canvas(width='auto', height='auto') script(type='text/javascript', src='jsmpeg.min.js') script(type='text/javascript'). player = new JSMpeg.Player('ws://' + window.location.hostname + ':4001/', { canvas: document.getElementById('canvas'), autoplay:true, loop:true // Canvas should be a canvas DOM element })

Can you support me to deploy this project to Heroku. I'm a newbie. Thank you so much!

lxtrungg avatar Jul 11 '20 06:07 lxtrungg

Unfortunately AFAIK Heroku only allows one port, meaning this project will only support one camera and nothing else.

You could try running two heroku apps, one for the browser and one for the camera stream.

If we end up going with a single-server model similar to #59 then that might solve this issue though.

kyriesent avatar Jul 24 '20 17:07 kyriesent