我有一个正在运行的nodejs服务器,当我发出一个api请求时,我想启动一个新的流并关闭/停止旧的流。启动新流的代码:
Stream = require('node-rtsp-stream');
this.stream = new Stream({
name: 'camera-stream',
streamUrl: 'rtsp://' + camera.cameraUserName + ':' + camera.cameraPassword
+ '@' + camera.cameraIp,
wsPort: 9999
});谁可以关闭/停止当前流?
我试过这段代码:
this.stream.mpeg1Muxer.stream.kill();
this.stream.streamUrl = 'rtsp://' + camera.cameraUserName + ':' +
camera.cameraPassword + '@' + camera.cameraIP + ':554';
this.stream.startMpeg1Stream();我不确定这是不是正确的方法。
发布于 2019-07-03 19:38:58
查看源代码,您会发现VideoStream.prototype.stop = function () {...},因此尝试这个函数this.stream.stop();
发布于 2019-02-08 14:58:25
node-rtsp-stream已更新为node-rtsp-stream-es6。在后者中,有一个函数.stop(),您可以调用它来停止流。
https://stackoverflow.com/questions/52147833
复制相似问题