Hi
I recently got a few Ubiquiti CCTV cameras and wanted to display the video on the Dashboard, I'm aware that this subject has been covered before however I didn't really want to use any other software to handle the RTP stream
Since the cameras support snapshot view whereby you can grab a still frame from the camera URL I thought that I might try to use this to simplify the process
The code below will allow "streaming" directly into the Dashboard without need of VLC or other software. The frame rate can be tinkered with but 15 fps is not too bad.
I created a UI template for each camera and modified the IP address as necessary
You'll need to change the IP address to your camera IP and ensure that "snapshot" is enabled in camera settings
It may work for other CCTV camera manufacturers if they support snapshot or still's
Maybe someone will find it of some use should they want a lightweight solution to incorporate their CCTV in the Dash
Thanks
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Image Refresh Two</title>
</head>
<body>
<!-- Get the initial image. -->
<img id="frameT" src="http://192.168.0.240/snap.jpeg">
<script>
// Use an off-screen image to load the next frame.
var imgT = new Image();
// When it is loaded...
imgT.addEventListener("load", function() {
// Set the on-screen image to the same source. This should be instant because
// it is already loaded.
document.getElementById("frameT").src = imgT.src;
// Schedule loading the next frame.
setTimeout(function() {
imgT.src = "http://192.168.0.240/snap.jpeg?" + (new Date).getTime();
}, 1000/15); // 15 FPS (more or less)
})
// Start the loading process.
imgT.src = "http://192.168.0.240/snap.jpeg?" + (new Date).getTime();
</script>
</body>
</html>