moved under cmds/tlcam
This commit is contained in:
51
cmds/tlcam/mjpg_streamer/www/javascript_simple.html
Normal file
51
cmds/tlcam/mjpg_streamer/www/javascript_simple.html
Normal file
@@ -0,0 +1,51 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>MJPEG-Streamer</title>
|
||||
</head>
|
||||
<script type="text/javascript">
|
||||
|
||||
/* Copyright (C) 2007 Richard Atterer, richard©atterer.net
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License, version 2. See the file
|
||||
COPYING for details. */
|
||||
|
||||
var imageNr = 0; // Serial number of current image
|
||||
var finished = new Array(); // References to img objects which have finished downloading
|
||||
var paused = false;
|
||||
|
||||
function createImageLayer() {
|
||||
var img = new Image();
|
||||
img.style.position = "absolute";
|
||||
img.style.zIndex = -1;
|
||||
img.onload = imageOnload;
|
||||
img.onclick = imageOnclick;
|
||||
img.src = "/?action=snapshot&n=" + (++imageNr);
|
||||
var webcam = document.getElementById("webcam");
|
||||
webcam.insertBefore(img, webcam.firstChild);
|
||||
}
|
||||
|
||||
// Two layers are always present (except at the very beginning), to avoid flicker
|
||||
function imageOnload() {
|
||||
this.style.zIndex = imageNr; // Image finished, bring to front!
|
||||
while (1 < finished.length) {
|
||||
var del = finished.shift(); // Delete old image(s) from document
|
||||
del.parentNode.removeChild(del);
|
||||
}
|
||||
finished.push(this);
|
||||
if (!paused) createImageLayer();
|
||||
}
|
||||
|
||||
function imageOnclick() { // Clicking on the image will pause the stream
|
||||
paused = !paused;
|
||||
if (!paused) createImageLayer();
|
||||
}
|
||||
|
||||
</script>
|
||||
<body onload="createImageLayer();">
|
||||
|
||||
<div id="webcam"><noscript><img src="/?action=snapshot" /></noscript></div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user