kyriesent / node-rtsp-stream

Stream any RTSP stream and output to websocket for consumption by jsmpeg (https://github.com/phoboslab/jsmpeg). HTML5 streaming video! Requires ffmpeg.
MIT License
451 stars 166 forks source link

"startMpeg1Stream is not a function" error #52

Closed joeyskeys closed 4 years ago

joeyskeys commented 4 years ago

hi guys, I'm trying to use node-rtsp-stream and got following error on my web page.

TypeError: this.startMpeg1Stream is not a function

at VideoStream (D:\Repos\floss\ffmpegToWeb\node_modules\node-rtsp-stream\videoStream.js:22:8)

at D:\Repos\floss\ffmpegToWeb\server.js:20:14

at Layer.handle [as handle_request] (D:\Repos\floss\ffmpegToWeb\node_modules\express\lib\router\layer.js:95:5)

at next (D:\Repos\floss\ffmpegToWeb\node_modules\express\lib\router\route.js:137:13)

at Route.dispatch (D:\Repos\floss\ffmpegToWeb\node_modules\express\lib\router\route.js:112:3)

at Layer.handle [as handle_request] (D:\Repos\floss\ffmpegToWeb\node_modules\express\lib\router\layer.js:95:5)

at D:\Repos\floss\ffmpegToWeb\node_modules\express\lib\router\index.js:281:22

at Function.process_params (D:\Repos\floss\ffmpegToWeb\node_modules\express\lib\router\index.js:335:12)

at next (D:\Repos\floss\ffmpegToWeb\node_modules\express\lib\router\index.js:275:10)

at expressInit (D:\Repos\floss\ffmpegToWeb\node_modules\express\lib\middleware\init.js:40:5)

my server is just simply a express server which respond to requests and send the html back, I init the stream in the new connection callback of server. my html is just like the example provided in the README.

Any ideas? Thanks in advance.

joeyskeys commented 4 years ago

just checked the source code, line 22 of videoStream.js is this.startMpeg1Stream() which is defined later in line 36, I'm totally new to js, but this looks correct to me, can anyone help?

3mber commented 4 years ago

i think you forgot to create an object from instance.

const Stream = require('node-rtsp-stream');
//const stream = Stream(); will throw the "is not function" error.
const stream = new Stream({...config});
kyriesent commented 4 years ago

This seems to be resolved so I am closing. Feel free to open another issue if need be.