![](/img/trans.png)
[英]NextJS not working with jsmpeg/node-rtsp-stream. Trying to display RTSP stream
[英]Proper way to stop a stream in node-rtsp-stream
我有一個運行中的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();
我不確定這是否是正確的方法。
查看源代碼,您會發現VideoStream.prototype.stop = function(){....},因此請嘗試-> this.stream.stop();。
node-rtsp-stream已更新為node-rtsp-stream-es6。 在后者中,有一個.stop()
函數,您可以調用該函數來停止流傳輸。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.