In my backend code (below) I am streaming rtsp
and I want to send it to my frontend code. Specifically, I want the streaming response data to be sent to my html page and rendered as a video in a canvas tag. Is this possible?
Stream = require('node-rtsp-stream');
router.post('/',function(req,res){
stream = new Stream({
name: 'name',
streamUrl:'rtsp://184.72.239.149/vod/mp4:BigBuckBunny_175k.mov',
wsPort: 9999
});
res.send(stream);
});
Frontend code is below:
$.ajax({
url:'/test',
type:'POST',
cache:false,
success:function(data){
console.log("RTSP Result : "+JSON.stringify(data))
var canvas = document.getElementById("videostream");
var ws = new WebSocket("ws://localhost:9999")
var player = new jsmpeg(ws, {canvas:canvas,
autoplay:true,audio:false,loop: true});
}
});