I have a jQuery camera plugin that uses the following command to take a snapshot.
<img id="camera_icon" src="images/icons/camera-icon2.png" onClick="take_snapshot()">
Here is the code it runs.
<script language="JavaScript">
function take_snapshot() {
// take snapshot and get image data
Webcam.snap( function(data_uri) {
// display results in page
document.getElementById('results').innerHTML =
'<h2>Saved Snapshot</h2>' +
'<img src="'+data_uri+'"/>';
Webcam.upload( data_uri, 'save_snapshot.php', function(code, text) {
// Upload complete!
// 'code' will be the HTTP response code from the server, e.g. 200
// 'text' will be the raw response content
});
});
}
</script>
I am looking for a solution that will count down from 5, and then take a snapshot when it reaches 0. Right now, when someone clicks the button, it will instantly take the picture. The solution doesn't have to be fancy, but should indicate to the user that it's counting down from 5.