No worries, glad its working......
Try this..... Navigate to /var/www
rename index.html to something else and then....
sudo nano index.html
And copy this in
Code: Select all
<!DOCTYPE html>
<html>
<head>
<title>Tankerton Slopes</title>
<script src="script_basic.js"></script>
</head>
<body onload="setTimeout('init();', 100);">
<center>
<h1>Tankerton Slopes - Live</h1>
<div><img id="mjpeg_dest"></div>
</body>
</html>
Then,
sudo nano script_basic.js
and copy this in
Code: Select all
//
// MJPEG
//
var mjpeg_img;
var halted = 0;
function reload_img () {
if(!halted) mjpeg_img.src = "cam_pic.php?time=" + new Date().getTime();
else setTimeout("reload_img()", 500);
}
function error_img () {
setTimeout("mjpeg_img.src = 'cam_pic.php?time=' + new Date().getTime();", 100);
}
//
// Ajax Status
//
var ajax_status;
if(window.XMLHttpRequest) {
ajax_status = new XMLHttpRequest();
}
else {
ajax_status = new ActiveXObject("Microsoft.XMLHTTP");
}
function reload_ajax (last) {
ajax_status.open("GET","status_mjpeg.php?last=" + last,true);
ajax_status.send();
}
//
// Ajax Commands
//
var ajax_cmd;
if(window.XMLHttpRequest) {
ajax_cmd = new XMLHttpRequest();
}
else {
ajax_cmd = new ActiveXObject("Microsoft.XMLHTTP");
}
function send_cmd (cmd) {
ajax_cmd.open("GET","cmd_pipe.php?cmd=" + cmd,true);
ajax_cmd.send();
}
//
// Init
//
function init() {
// mjpeg
mjpeg_img = document.getElementById("mjpeg_dest");
mjpeg_img.onload = reload_img;
mjpeg_img.onerror = error_img;
reload_img();
// status
reload_ajax("");
}