admin管理员组文章数量:1406943
I am new to node.js and was debugging a code written by another developer. We have a an IP camera which provides rtsp feed which is being displayed on a webpage. I can view the camera feed using the rtsp url in VLC but the web viewer of camera feed usually gives white screen although it somehow works intermittently.
I was told that it used to work properly when the machine was on Ubuntu 20.04 now it has been updated to Ubuntu 24.
Index.js
const Stream = require("node-rtsp-stream-jsmpeg");
const fs = require("fs");
const https = require("https");
const httpsServer = https.createServer({
key: fs.readFileSync("./cert/ssl.key"),
cert: fs.readFileSync("./cert/ssl.crt"),
});
const options = {
name: "streamName",
url: "rtsp://10.20.xxx.xx/profile1",
wsPort: 3333,
httpsServer: httpsServer
};
let stream = new Stream(options);
stream.start();
index.html
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>DEMO node-rtsp-stream-jsmpeg</title>
<script src=".min.js"></script>
</head>
<body>
<div>
<canvas id="video-canvas">
</canvas>
</div>
<script type="text/javascript">
var url = "ws://localhost:3333";
var canvas = document.getElementById('video-canvas');
var player = new JSMpeg.Player(url, {canvas: canvas});
</script>
</body>
I tried reinstalling the node modules but it didn't make any difference. I am sure that there is no hardware issue as rtsp connection always works in VLC.
Following is the console log when it fails Following is the console log when it works
本文标签: nodejsrtsp feed fails intermittently using node jsStack Overflow
版权声明:本文标题:node.js - rtsp feed fails intermittently using node js - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744941345a2633505.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论