I have created various JavaScript functions to capture photo from the browser. Using the JavaScript functions i can successfully launch camera, capture photos and preview it and then able to upload the photos.
I am thinking to integrate photo timer function. Here, once i click on the take photo button it will wait for 3 seconds (for example) and will display an animated timer (i am thinking to load a an Animated gif file) that will countdown 3 to 1. Once the countdown is finished i want to call the photo capturing function.
But i could not able to integrate this logic in my photo capturing functionality!
My sample code is :
var cameraEnabled = false;
var timer = null;
$('#takeButton').click(function(){
if(timer != null)
{
clearTimeout(timer);
timer = null;
}
else
{
if(!cameraEnabled){
return false;
}
timer = window.setTimeout(webcam.show_image(), 3000);
webcam.freeze();
togglePane();
return false;
}
});
My show_image function is:
show_image:function()
{
var img = document.createElement("img");
img.src = "countdowntimer.gif";
document.body.appendChild(img);
},
Could anyone please help me on this issue?
Advance thanks for your responses.