Namenskorrektur
This commit is contained in:
parent
9eaa4a841c
commit
c0258314f4
73 changed files with 0 additions and 0 deletions
40
fotokiosk/fotokiste/static/javascript/mjp-streamer.js
Normal file
40
fotokiosk/fotokiste/static/javascript/mjp-streamer.js
Normal file
|
@ -0,0 +1,40 @@
|
|||
/* 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.style.width = "400px";
|
||||
img.style.height = "320px";
|
||||
img.onload = imageOnload;
|
||||
img.onclick = imageOnclick;
|
||||
img.src = "http://fotokiste:8081/?action=snapshot&n=" + (++imageNr);
|
||||
var webcam = document.getElementById("live_pic");
|
||||
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) window.setTimeout(createImageLayer(), 1000);
|
||||
}
|
||||
|
||||
function imageOnclick() { // Clicking on the image will pause the stream
|
||||
paused = !paused;
|
||||
if (!paused) createImageLayer();
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue