Ok, so i have to merge those two codes to make stuffs work:
The idea is to have a stream as wide as the vertical display at the current place of the “message module”. Is anyone with a suggestion on how to make it work? Tomorrow i’ll start the trials.
php:
<!DOCTYPE html>
<html>
<head>
<title>RPi Cam Preview</title>
<script src="script_min.js"></script>
</head>
<body onload="setTimeout('init();', 100);">
<center>
<div><img id="mjpeg_dest" /></div>
</center>
</body>
</html>
js:
var mjpeg_img;
function reload_img () {
mjpeg_img.src = "cam_pic.php?time=" + new Date().getTime();
}
function error_img () {
setTimeout("mjpeg_img.src = 'cam_pic.php?time=' + new Date().getTime();", 100);
}
function init() {
mjpeg_img = document.getElementById("mjpeg_dest");
mjpeg_img.onload = reload_img;
mjpeg_img.onerror = error_img;
reload_img();
}
Note from admin: Please use Markdown on code snippets for easier reading!