Reputation: 723
i'm trying to get a RTSP stream inside a webpage, but with no success actually.
For this I followed exactly the tutorial of JSMpeg : https://github.com/phoboslab/jsmpeg
With a custom FFMPEG command :
ffmpeg -i "rtsp://myurl/media.smp" \
-vcodec h264 -f mpegts -codec:v mpeg1video -s 1290x980 -b:v 8000k \
-r 25 -max_muxing_queue_size 9999 http://localhost:8081/supersecret
My websocket well receive my connection on it.
But my canvas is still a white square :
The weird thing is when I change the websocket url with a false one, in my code, the canvas turn to black.
So I guess that it turn WHITE when it receive something.
Thansk for help
Upvotes: 3
Views: 1750
Reputation: 89
Most likely you'll have fixed this already, just leaving these here for others that come across the same issue.
In my case i was forgetting the call to start()
on the newly create stream object.
The function below is part of an object I created to keep track of the streams in instantiate, useful for multiclient multistream situation.
createStream: async function (rtspURL) {
const myPort=9999
console.log(`Assigning port ${myPort} to new stream` );
try {
this.streams[rtspURL] = new Stream({
name: 'stream:'+rtspURL,
url: rtspURL,
wsPort: myPort
});
console.log("New stream instance created");
console.log(this.streams[rtspURL] );
this.streams[rtspURL].start();
return myPort;
} catch (error) {
console.error("Error while instanciating new stream")
}
}
Upvotes: 0