[英]Proper way to stop a stream in node-rtsp-stream
I have a nodejs server running and when I make an api request I want to start a new stream and close/stop the old one. 我有一个运行中的nodejs服务器,当我发出api请求时,我想启动一个新流并关闭/停止旧流。 The code for starting a new stream:
启动新流的代码:
Stream = require('node-rtsp-stream');
this.stream = new Stream({
name: 'camera-stream',
streamUrl: 'rtsp://' + camera.cameraUserName + ':' + camera.cameraPassword
+ '@' + camera.cameraIp,
wsPort: 9999
});
Who can i close/stop the current stream? 谁可以关闭/停止当前视频流?
I tried this code: 我尝试了这段代码:
this.stream.mpeg1Muxer.stream.kill();
this.stream.streamUrl = 'rtsp://' + camera.cameraUserName + ':' +
camera.cameraPassword + '@' + camera.cameraIP + ':554';
this.stream.startMpeg1Stream();
I'm not sure that this is the right way to do that. 我不确定这是否是正确的方法。
查看源代码,您会发现VideoStream.prototype.stop = function(){....},因此请尝试-> this.stream.stop();。
node-rtsp-stream has been updated to node-rtsp-stream-es6. node-rtsp-stream已更新为node-rtsp-stream-es6。 In the latter, there is a function
.stop()
that you can call to stop the streaming. 在后者中,有一个
.stop()
函数,您可以调用该函数来停止流传输。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.