set version 0.0.20
This commit is contained in:
56
doc/webcamjs/demos/basic.html
Normal file
56
doc/webcamjs/demos/basic.html
Normal file
@@ -0,0 +1,56 @@
|
||||
<!doctype html>
|
||||
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<title>WebcamJS Test Page</title>
|
||||
<style type="text/css">
|
||||
body { font-family: Helvetica, sans-serif; }
|
||||
h2, h3 { margin-top:0; }
|
||||
form { margin-top: 15px; }
|
||||
form > input { margin-right: 15px; }
|
||||
#results { float:right; margin:20px; padding:20px; border:1px solid; background:#ccc; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="results">Your captured image will appear here...</div>
|
||||
|
||||
<h1>WebcamJS Test Page</h1>
|
||||
<h3>Demonstrates simple 320x240 capture & display</h3>
|
||||
|
||||
<div id="my_camera"></div>
|
||||
|
||||
<!-- First, include the Webcam.js JavaScript Library -->
|
||||
<script type="text/javascript" src="../webcam.js"></script>
|
||||
|
||||
<!-- Configure a few settings and attach camera -->
|
||||
<script language="JavaScript">
|
||||
Webcam.set({
|
||||
width: 320,
|
||||
height: 240,
|
||||
image_format: 'jpeg',
|
||||
jpeg_quality: 90
|
||||
});
|
||||
Webcam.attach( '#my_camera' );
|
||||
</script>
|
||||
|
||||
<!-- A button for taking snaps -->
|
||||
<form>
|
||||
<input type=button value="Take Snapshot" onClick="take_snapshot()">
|
||||
</form>
|
||||
|
||||
<!-- Code to handle taking the snapshot and displaying it locally -->
|
||||
<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>Here is your image:</h2>' +
|
||||
'<img src="'+data_uri+'"/>';
|
||||
} );
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
61
doc/webcamjs/demos/click-to-run.html
Normal file
61
doc/webcamjs/demos/click-to-run.html
Normal file
@@ -0,0 +1,61 @@
|
||||
<!doctype html>
|
||||
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<title>WebcamJS Test Page</title>
|
||||
<style type="text/css">
|
||||
body { font-family: Helvetica, sans-serif; }
|
||||
h2, h3 { margin-top:0; }
|
||||
form { margin-top: 15px; }
|
||||
form > input { margin-right: 15px; }
|
||||
#results { float:right; margin:20px; padding:20px; border:1px solid; background:#ccc; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="results">Your captured image will appear here...</div>
|
||||
|
||||
<h1>WebcamJS Test Page</h1>
|
||||
<h3>Demonstrates setting up camera after a click.</h3>
|
||||
|
||||
<div id="my_camera"></div>
|
||||
|
||||
<!-- First, include the Webcam.js JavaScript Library -->
|
||||
<script src="http://code.jquery.com/jquery-2.1.4.min.js"></script>
|
||||
<script type="text/javascript" src="../webcam.js"></script>
|
||||
|
||||
<!-- Configure a few settings and attach camera -->
|
||||
<script language="JavaScript">
|
||||
Webcam.set({
|
||||
width: 320,
|
||||
height: 240,
|
||||
image_format: 'jpeg',
|
||||
jpeg_quality: 90
|
||||
});
|
||||
</script>
|
||||
|
||||
<!-- A button for taking snaps -->
|
||||
<form>
|
||||
<input type="button" value="Access Camera" onClick="setup(); $(this).hide().next().show();">
|
||||
<input type="button" value="Take Snapshot" onClick="take_snapshot()" style="display:none">
|
||||
</form>
|
||||
|
||||
<!-- Code to handle taking the snapshot and displaying it locally -->
|
||||
<script language="JavaScript">
|
||||
function setup() {
|
||||
Webcam.attach( '#my_camera' );
|
||||
}
|
||||
|
||||
function take_snapshot() {
|
||||
// take snapshot and get image data
|
||||
Webcam.snap( function(data_uri) {
|
||||
// display results in page
|
||||
document.getElementById('results').innerHTML =
|
||||
'<h2>Here is your image:</h2>' +
|
||||
'<img src="'+data_uri+'"/>';
|
||||
} );
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
119
doc/webcamjs/demos/combo.html
Normal file
119
doc/webcamjs/demos/combo.html
Normal file
@@ -0,0 +1,119 @@
|
||||
<!doctype html>
|
||||
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<title>WebcamJS Test Page</title>
|
||||
<style type="text/css">
|
||||
body { font-family: Helvetica, sans-serif; }
|
||||
h1, h2, h3 { margin-top:0; margin-bottom:0; }
|
||||
form { margin-top: 15px; }
|
||||
form input { margin-right: 15px; }
|
||||
#results { display:inline-block; margin:20px; padding:20px; border:1px solid; background:#ccc; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1>WebcamJS Test Page</h1>
|
||||
<h3>Demonstrates all features at once</h3>
|
||||
<div style="margin-top:5px; margin-bottom:20px;">Captures large 480x480 cropped image while displaying live 240x240 preview, flipped horizontally (mirrored), and allows preview before save.</div>
|
||||
|
||||
<div id="my_photo_booth">
|
||||
<div id="my_camera"></div>
|
||||
|
||||
<!-- First, include the Webcam.js JavaScript Library -->
|
||||
<script type="text/javascript" src="../webcam.js"></script>
|
||||
|
||||
<!-- Configure a few settings and attach camera -->
|
||||
<script language="JavaScript">
|
||||
Webcam.set({
|
||||
// live preview size
|
||||
width: 320,
|
||||
height: 240,
|
||||
|
||||
// device capture size
|
||||
dest_width: 640,
|
||||
dest_height: 480,
|
||||
|
||||
// final cropped size
|
||||
crop_width: 480,
|
||||
crop_height: 480,
|
||||
|
||||
// format and quality
|
||||
image_format: 'jpeg',
|
||||
jpeg_quality: 90,
|
||||
|
||||
// flip horizontal (mirror mode)
|
||||
flip_horiz: true
|
||||
});
|
||||
Webcam.attach( '#my_camera' );
|
||||
</script>
|
||||
|
||||
<!-- A button for taking snaps -->
|
||||
<form>
|
||||
<div id="pre_take_buttons">
|
||||
<!-- This button is shown before the user takes a snapshot -->
|
||||
<input type=button value="Take Snapshot" onClick="preview_snapshot()">
|
||||
</div>
|
||||
<div id="post_take_buttons" style="display:none">
|
||||
<!-- These buttons are shown after a snapshot is taken -->
|
||||
<input type=button value="< Take Another" onClick="cancel_preview()">
|
||||
<input type=button value="Save Photo >" onClick="save_photo()" style="font-weight:bold;">
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div id="results" style="display:none">
|
||||
<!-- Your captured image will appear here... -->
|
||||
</div>
|
||||
|
||||
<!-- Code to handle taking the snapshot and displaying it locally -->
|
||||
<script language="JavaScript">
|
||||
// preload shutter audio clip
|
||||
var shutter = new Audio();
|
||||
shutter.autoplay = false;
|
||||
shutter.src = navigator.userAgent.match(/Firefox/) ? 'shutter.ogg' : 'shutter.mp3';
|
||||
|
||||
function preview_snapshot() {
|
||||
// play sound effect
|
||||
try { shutter.currentTime = 0; } catch(e) {;} // fails in IE
|
||||
shutter.play();
|
||||
|
||||
// freeze camera so user can preview current frame
|
||||
Webcam.freeze();
|
||||
|
||||
// swap button sets
|
||||
document.getElementById('pre_take_buttons').style.display = 'none';
|
||||
document.getElementById('post_take_buttons').style.display = '';
|
||||
}
|
||||
|
||||
function cancel_preview() {
|
||||
// cancel preview freeze and return to live camera view
|
||||
Webcam.unfreeze();
|
||||
|
||||
// swap buttons back to first set
|
||||
document.getElementById('pre_take_buttons').style.display = '';
|
||||
document.getElementById('post_take_buttons').style.display = 'none';
|
||||
}
|
||||
|
||||
function save_photo() {
|
||||
// actually snap photo (from preview freeze) and display it
|
||||
Webcam.snap( function(data_uri) {
|
||||
// display results in page
|
||||
document.getElementById('results').innerHTML =
|
||||
'<h2>Here is your large, cropped image:</h2>' +
|
||||
'<img src="'+data_uri+'"/><br/></br>' +
|
||||
'<a href="'+data_uri+'" target="_blank">Open image in new window...</a>';
|
||||
|
||||
// shut down camera, stop capturing
|
||||
Webcam.reset();
|
||||
|
||||
// show results, hide photo booth
|
||||
document.getElementById('results').style.display = '';
|
||||
document.getElementById('my_photo_booth').style.display = 'none';
|
||||
} );
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
66
doc/webcamjs/demos/constraints.html
Normal file
66
doc/webcamjs/demos/constraints.html
Normal file
@@ -0,0 +1,66 @@
|
||||
<!doctype html>
|
||||
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<title>WebcamJS Constraints Test Page</title>
|
||||
<style type="text/css">
|
||||
body { font-family: Helvetica, sans-serif; }
|
||||
h2, h3 { margin-top:0; }
|
||||
form { margin-top: 15px; }
|
||||
form > input { margin-right: 15px; }
|
||||
#results { float:right; margin:20px; padding:20px; border:1px solid; background:#ccc; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="results">Your captured image will appear here...</div>
|
||||
|
||||
<h1>WebcamJS Constraints Test Page</h1>
|
||||
<h3>Demonstrates using the HTML5 user media constraints object</h3>
|
||||
|
||||
<div id="my_camera"></div>
|
||||
|
||||
<!-- First, include the Webcam.js JavaScript Library -->
|
||||
<script type="text/javascript" src="../webcam.js"></script>
|
||||
|
||||
<!-- Configure a few settings and attach camera -->
|
||||
<script language="JavaScript">
|
||||
Webcam.set({
|
||||
width: 320,
|
||||
height: 240,
|
||||
image_format: 'jpeg',
|
||||
jpeg_quality: 90,
|
||||
constraints: {
|
||||
mandatory: {
|
||||
minWidth: 320,
|
||||
minHeight: 240
|
||||
// minFrameRate: 30
|
||||
},
|
||||
optional: [
|
||||
{ minFrameRate: 60 }
|
||||
]
|
||||
}
|
||||
});
|
||||
Webcam.attach( '#my_camera' );
|
||||
</script>
|
||||
|
||||
<!-- A button for taking snaps -->
|
||||
<form>
|
||||
<input type=button value="Take Snapshot" onClick="take_snapshot()">
|
||||
</form>
|
||||
|
||||
<!-- Code to handle taking the snapshot and displaying it locally -->
|
||||
<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>Here is your image:</h2>' +
|
||||
'<img src="'+data_uri+'"/>';
|
||||
} );
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
68
doc/webcamjs/demos/crop-large.html
Normal file
68
doc/webcamjs/demos/crop-large.html
Normal file
@@ -0,0 +1,68 @@
|
||||
<!doctype html>
|
||||
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<title>WebcamJS Test Page</title>
|
||||
<style type="text/css">
|
||||
body { font-family: Helvetica, sans-serif; }
|
||||
h2, h3 { margin-top:0; }
|
||||
form { margin-top: 15px; }
|
||||
form > input { margin-right: 15px; }
|
||||
#results { float:right; margin:20px; padding:20px; border:1px solid; background:#ccc; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="results">Your captured image will appear here...</div>
|
||||
|
||||
<h1>WebcamJS Test Page</h1>
|
||||
<h3>Demonstrates 480x480 cropped capture & 240x240 small display</h3>
|
||||
|
||||
<div id="my_camera"></div>
|
||||
|
||||
<!-- First, include the Webcam.js JavaScript Library -->
|
||||
<script type="text/javascript" src="../webcam.js"></script>
|
||||
|
||||
<!-- Configure a few settings and attach camera -->
|
||||
<script language="JavaScript">
|
||||
Webcam.set({
|
||||
// live preview size
|
||||
width: 320,
|
||||
height: 240,
|
||||
|
||||
// device capture size
|
||||
dest_width: 640,
|
||||
dest_height: 480,
|
||||
|
||||
// final cropped size
|
||||
crop_width: 480,
|
||||
crop_height: 480,
|
||||
|
||||
// format and quality
|
||||
image_format: 'jpeg',
|
||||
jpeg_quality: 90
|
||||
});
|
||||
|
||||
Webcam.attach( '#my_camera' );
|
||||
</script>
|
||||
|
||||
<!-- A button for taking snaps -->
|
||||
<form>
|
||||
<input type=button value="Take Large Snapshot" onClick="take_snapshot()">
|
||||
</form>
|
||||
|
||||
<!-- Code to handle taking the snapshot and displaying it locally -->
|
||||
<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>Here is your large image:</h2>' +
|
||||
'<img src="'+data_uri+'"/>';
|
||||
} );
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
68
doc/webcamjs/demos/crop.html
Normal file
68
doc/webcamjs/demos/crop.html
Normal file
@@ -0,0 +1,68 @@
|
||||
<!doctype html>
|
||||
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<title>WebcamJS Test Page</title>
|
||||
<style type="text/css">
|
||||
body { font-family: Helvetica, sans-serif; }
|
||||
h2, h3 { margin-top:0; }
|
||||
form { margin-top: 15px; }
|
||||
form > input { margin-right: 15px; }
|
||||
#results { float:right; margin:20px; padding:20px; border:1px solid; background:#ccc; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="results">Your captured image will appear here...</div>
|
||||
|
||||
<h1>WebcamJS Test Page</h1>
|
||||
<h3>Demonstrates 240x240 cropped capture & display</h3>
|
||||
|
||||
<div id="my_camera"></div>
|
||||
|
||||
<!-- First, include the Webcam.js JavaScript Library -->
|
||||
<script type="text/javascript" src="../webcam.js"></script>
|
||||
|
||||
<!-- Configure a few settings and attach camera -->
|
||||
<script language="JavaScript">
|
||||
Webcam.set({
|
||||
// live preview size
|
||||
width: 320,
|
||||
height: 240,
|
||||
|
||||
// device capture size
|
||||
dest_width: 320,
|
||||
dest_height: 240,
|
||||
|
||||
// final cropped size
|
||||
crop_width: 240,
|
||||
crop_height: 240,
|
||||
|
||||
// format and quality
|
||||
image_format: 'jpeg',
|
||||
jpeg_quality: 90
|
||||
});
|
||||
|
||||
Webcam.attach( '#my_camera' );
|
||||
</script>
|
||||
|
||||
<!-- A button for taking snaps -->
|
||||
<form>
|
||||
<input type=button value="Take Snapshot" onClick="take_snapshot()">
|
||||
</form>
|
||||
|
||||
<!-- Code to handle taking the snapshot and displaying it locally -->
|
||||
<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>Here is your image:</h2>' +
|
||||
'<img src="'+data_uri+'"/>';
|
||||
} );
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
65
doc/webcamjs/demos/events.html
Normal file
65
doc/webcamjs/demos/events.html
Normal file
@@ -0,0 +1,65 @@
|
||||
<!doctype html>
|
||||
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<title>WebcamJS Event Test Page</title>
|
||||
<style type="text/css">
|
||||
body { font-family: Helvetica, sans-serif; }
|
||||
h2, h3 { margin-top:0; }
|
||||
form { margin-top: 15px; }
|
||||
form > input { margin-right: 15px; }
|
||||
#results { float:right; margin:20px; padding:20px; border:1px solid; background:#ccc; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="results"></div>
|
||||
|
||||
<h1>WebcamJS Event Test Page</h1>
|
||||
<h3>Demonstrates simple 320x240 capture & display with events</h3>
|
||||
<p><script> document.write(navigator.userAgent); </script></p>
|
||||
|
||||
<div id="my_camera"></div>
|
||||
|
||||
<!-- First, include the Webcam.js JavaScript Library -->
|
||||
<script type="text/javascript" src="../webcam.js"></script>
|
||||
|
||||
<!-- Configure a few settings and attach camera -->
|
||||
<script language="JavaScript">
|
||||
Webcam.set({
|
||||
width: 320,
|
||||
height: 240,
|
||||
image_format: 'jpeg',
|
||||
jpeg_quality: 90
|
||||
});
|
||||
|
||||
Webcam.on( 'load', function() {
|
||||
document.getElementById('results').innerHTML += '<p><b>EVENT FIRED:</b> Library loaded.</p>';
|
||||
} );
|
||||
Webcam.on( 'live', function() {
|
||||
document.getElementById('results').innerHTML += '<p><b>EVENT FIRED:</b> Camera is live.</p>';
|
||||
} );
|
||||
|
||||
Webcam.attach( '#my_camera' );
|
||||
</script>
|
||||
|
||||
<!-- A button for taking snaps -->
|
||||
<form>
|
||||
<input type=button value="Take Snapshot" onClick="take_snapshot()">
|
||||
</form>
|
||||
|
||||
<!-- Code to handle taking the snapshot and displaying it locally -->
|
||||
<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>Here is your image:</h2>' +
|
||||
'<img src="'+data_uri+'"/>';
|
||||
} );
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
57
doc/webcamjs/demos/flash.html
Normal file
57
doc/webcamjs/demos/flash.html
Normal file
@@ -0,0 +1,57 @@
|
||||
<!doctype html>
|
||||
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<title>WebcamJS Test Page</title>
|
||||
<style type="text/css">
|
||||
body { font-family: Helvetica, sans-serif; }
|
||||
h2, h3 { margin-top:0; }
|
||||
form { margin-top: 15px; }
|
||||
form > input { margin-right: 15px; }
|
||||
#results { float:right; margin:20px; padding:20px; border:1px solid; background:#ccc; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="results">Your captured image will appear here...</div>
|
||||
|
||||
<h1>WebcamJS Test Page</h1>
|
||||
<h3>Demonstrates Adobe Flash capture & display</h3>
|
||||
|
||||
<div id="my_camera"></div>
|
||||
|
||||
<!-- First, include the Webcam.js JavaScript Library -->
|
||||
<script type="text/javascript" src="../webcam.js"></script>
|
||||
|
||||
<!-- Configure a few settings and attach camera -->
|
||||
<script language="JavaScript">
|
||||
Webcam.set({
|
||||
width: 320,
|
||||
height: 240,
|
||||
force_flash: true,
|
||||
image_format: 'jpeg',
|
||||
jpeg_quality: 90
|
||||
});
|
||||
Webcam.attach( '#my_camera' );
|
||||
</script>
|
||||
|
||||
<!-- A button for taking snaps -->
|
||||
<form>
|
||||
<input type=button value="Take Snapshot" onClick="take_snapshot()">
|
||||
</form>
|
||||
|
||||
<!-- Code to handle taking the snapshot and displaying it locally -->
|
||||
<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>Here is your image:</h2>' +
|
||||
'<img src="'+data_uri+'"/>';
|
||||
} );
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
58
doc/webcamjs/demos/flip-flash.html
Normal file
58
doc/webcamjs/demos/flip-flash.html
Normal file
@@ -0,0 +1,58 @@
|
||||
<!doctype html>
|
||||
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<title>WebcamJS Test Page</title>
|
||||
<style type="text/css">
|
||||
body { font-family: Helvetica, sans-serif; }
|
||||
h2, h3 { margin-top:0; }
|
||||
form { margin-top: 15px; }
|
||||
form > input { margin-right: 15px; }
|
||||
#results { float:right; margin:20px; padding:20px; border:1px solid; background:#ccc; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="results">Your captured image will appear here...</div>
|
||||
|
||||
<h1>WebcamJS Test Page</h1>
|
||||
<h3>Demonstrates horizontal flipped (mirrored) 320x240 capture & display</h3>
|
||||
|
||||
<div id="my_camera"></div>
|
||||
|
||||
<!-- First, include the Webcam.js JavaScript Library -->
|
||||
<script type="text/javascript" src="../webcam.js"></script>
|
||||
|
||||
<!-- Configure a few settings and attach camera -->
|
||||
<script language="JavaScript">
|
||||
Webcam.set({
|
||||
width: 320,
|
||||
height: 240,
|
||||
image_format: 'jpeg',
|
||||
jpeg_quality: 90,
|
||||
flip_horiz: true,
|
||||
force_flash: true
|
||||
});
|
||||
Webcam.attach( '#my_camera' );
|
||||
</script>
|
||||
|
||||
<!-- A button for taking snaps -->
|
||||
<form>
|
||||
<input type=button value="Take Snapshot" onClick="take_snapshot()">
|
||||
</form>
|
||||
|
||||
<!-- Code to handle taking the snapshot and displaying it locally -->
|
||||
<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>Here is your image:</h2>' +
|
||||
'<img src="'+data_uri+'"/>';
|
||||
} );
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
57
doc/webcamjs/demos/flip.html
Normal file
57
doc/webcamjs/demos/flip.html
Normal file
@@ -0,0 +1,57 @@
|
||||
<!doctype html>
|
||||
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<title>WebcamJS Test Page</title>
|
||||
<style type="text/css">
|
||||
body { font-family: Helvetica, sans-serif; }
|
||||
h2, h3 { margin-top:0; }
|
||||
form { margin-top: 15px; }
|
||||
form > input { margin-right: 15px; }
|
||||
#results { float:right; margin:20px; padding:20px; border:1px solid; background:#ccc; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="results">Your captured image will appear here...</div>
|
||||
|
||||
<h1>WebcamJS Test Page</h1>
|
||||
<h3>Demonstrates horizontal flipped (mirrored) 320x240 capture & display</h3>
|
||||
|
||||
<div id="my_camera"></div>
|
||||
|
||||
<!-- First, include the Webcam.js JavaScript Library -->
|
||||
<script type="text/javascript" src="../webcam.js"></script>
|
||||
|
||||
<!-- Configure a few settings and attach camera -->
|
||||
<script language="JavaScript">
|
||||
Webcam.set({
|
||||
width: 320,
|
||||
height: 240,
|
||||
image_format: 'jpeg',
|
||||
jpeg_quality: 90,
|
||||
flip_horiz: true
|
||||
});
|
||||
Webcam.attach( '#my_camera' );
|
||||
</script>
|
||||
|
||||
<!-- A button for taking snaps -->
|
||||
<form>
|
||||
<input type=button value="Take Snapshot" onClick="take_snapshot()">
|
||||
</form>
|
||||
|
||||
<!-- Code to handle taking the snapshot and displaying it locally -->
|
||||
<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>Here is your image:</h2>' +
|
||||
'<img src="'+data_uri+'"/>';
|
||||
} );
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
56
doc/webcamjs/demos/hd.html
Normal file
56
doc/webcamjs/demos/hd.html
Normal file
@@ -0,0 +1,56 @@
|
||||
<!doctype html>
|
||||
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<title>WebcamJS Test Page - HD Capture</title>
|
||||
<style type="text/css">
|
||||
body { font-family: Helvetica, sans-serif; }
|
||||
h2, h3 { margin-top:0; }
|
||||
form { margin-top: 15px; }
|
||||
form > input { margin-right: 15px; }
|
||||
#results { margin:20px; padding:20px; border:1px solid; background:#ccc; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>WebcamJS Test Page - HD Capture</h1>
|
||||
<h3>Demonstrates 720p HD capture (1280x720), if your camera supports it!</h3>
|
||||
|
||||
<div id="my_camera"></div>
|
||||
|
||||
<!-- First, include the Webcam.js JavaScript Library -->
|
||||
<script type="text/javascript" src="../webcam.js"></script>
|
||||
|
||||
<!-- Configure a few settings and attach camera -->
|
||||
<script language="JavaScript">
|
||||
Webcam.set({
|
||||
width: 1280,
|
||||
height: 720,
|
||||
image_format: 'jpeg',
|
||||
jpeg_quality: 90
|
||||
});
|
||||
Webcam.attach( '#my_camera' );
|
||||
</script>
|
||||
|
||||
<!-- A button for taking snaps -->
|
||||
<form>
|
||||
<input type=button value="Take HD Snapshot" onClick="take_snapshot()">
|
||||
</form>
|
||||
|
||||
<!-- Code to handle taking the snapshot and displaying it locally -->
|
||||
<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>Here is your large image:</h2>' +
|
||||
'<img src="'+data_uri+'"/>';
|
||||
} );
|
||||
}
|
||||
</script>
|
||||
|
||||
<div id="results">Your captured image will appear here...</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
58
doc/webcamjs/demos/large.html
Normal file
58
doc/webcamjs/demos/large.html
Normal file
@@ -0,0 +1,58 @@
|
||||
<!doctype html>
|
||||
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<title>WebcamJS Test Page - Large Capture</title>
|
||||
<style type="text/css">
|
||||
body { font-family: Helvetica, sans-serif; }
|
||||
h2, h3 { margin-top:0; }
|
||||
form { margin-top: 15px; }
|
||||
form > input { margin-right: 15px; }
|
||||
#results { float:right; margin:20px; padding:20px; border:1px solid; background:#ccc; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="results">Your captured image will appear here...</div>
|
||||
|
||||
<h1>WebcamJS Test Page - Large Capture</h1>
|
||||
<h3>Demonstrates 640x480 large capture with 320x240 small display</h3>
|
||||
|
||||
<div id="my_camera"></div>
|
||||
|
||||
<!-- First, include the Webcam.js JavaScript Library -->
|
||||
<script type="text/javascript" src="../webcam.js"></script>
|
||||
|
||||
<!-- Configure a few settings and attach camera -->
|
||||
<script language="JavaScript">
|
||||
Webcam.set({
|
||||
width: 320,
|
||||
height: 240,
|
||||
dest_width: 640,
|
||||
dest_height: 480,
|
||||
image_format: 'jpeg',
|
||||
jpeg_quality: 90
|
||||
});
|
||||
Webcam.attach( '#my_camera' );
|
||||
</script>
|
||||
|
||||
<!-- A button for taking snaps -->
|
||||
<form>
|
||||
<input type=button value="Take Large Snapshot" onClick="take_snapshot()">
|
||||
</form>
|
||||
|
||||
<!-- Code to handle taking the snapshot and displaying it locally -->
|
||||
<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>Here is your large image:</h2>' +
|
||||
'<img src="'+data_uri+'"/>';
|
||||
} );
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
84
doc/webcamjs/demos/preview.html
Normal file
84
doc/webcamjs/demos/preview.html
Normal file
@@ -0,0 +1,84 @@
|
||||
<!doctype html>
|
||||
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<title>WebcamJS Test Page</title>
|
||||
<style type="text/css">
|
||||
body { font-family: Helvetica, sans-serif; }
|
||||
h2, h3 { margin-top:0; }
|
||||
form { margin-top: 15px; }
|
||||
form input { margin-right: 15px; }
|
||||
#results { float:right; margin:20px; padding:20px; border:1px solid; background:#ccc; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="results">Your captured image will appear here...</div>
|
||||
|
||||
<h1>WebcamJS Test Page</h1>
|
||||
<h3>Demonstrates 320x240 capture & display with preview mode</h3>
|
||||
|
||||
<div id="my_camera"></div>
|
||||
|
||||
<!-- First, include the Webcam.js JavaScript Library -->
|
||||
<script type="text/javascript" src="../webcam.js"></script>
|
||||
|
||||
<!-- Configure a few settings and attach camera -->
|
||||
<script language="JavaScript">
|
||||
Webcam.set({
|
||||
width: 320,
|
||||
height: 240,
|
||||
image_format: 'jpeg',
|
||||
jpeg_quality: 90
|
||||
});
|
||||
Webcam.attach( '#my_camera' );
|
||||
</script>
|
||||
|
||||
<!-- A button for taking snaps -->
|
||||
<form>
|
||||
<div id="pre_take_buttons">
|
||||
<input type=button value="Take Snapshot" onClick="preview_snapshot()">
|
||||
</div>
|
||||
<div id="post_take_buttons" style="display:none">
|
||||
<input type=button value="< Take Another" onClick="cancel_preview()">
|
||||
<input type=button value="Save Photo >" onClick="save_photo()" style="font-weight:bold;">
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<!-- Code to handle taking the snapshot and displaying it locally -->
|
||||
<script language="JavaScript">
|
||||
function preview_snapshot() {
|
||||
// freeze camera so user can preview pic
|
||||
Webcam.freeze();
|
||||
|
||||
// swap button sets
|
||||
document.getElementById('pre_take_buttons').style.display = 'none';
|
||||
document.getElementById('post_take_buttons').style.display = '';
|
||||
}
|
||||
|
||||
function cancel_preview() {
|
||||
// cancel preview freeze and return to live camera feed
|
||||
Webcam.unfreeze();
|
||||
|
||||
// swap buttons back
|
||||
document.getElementById('pre_take_buttons').style.display = '';
|
||||
document.getElementById('post_take_buttons').style.display = 'none';
|
||||
}
|
||||
|
||||
function save_photo() {
|
||||
// actually snap photo (from preview freeze) and display it
|
||||
Webcam.snap( function(data_uri) {
|
||||
// display results in page
|
||||
document.getElementById('results').innerHTML =
|
||||
'<h2>Here is your image:</h2>' +
|
||||
'<img src="'+data_uri+'"/>';
|
||||
|
||||
// swap buttons back
|
||||
document.getElementById('pre_take_buttons').style.display = '';
|
||||
document.getElementById('post_take_buttons').style.display = 'none';
|
||||
} );
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
57
doc/webcamjs/demos/reset.html
Normal file
57
doc/webcamjs/demos/reset.html
Normal file
@@ -0,0 +1,57 @@
|
||||
<!doctype html>
|
||||
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<title>WebcamJS Test Page</title>
|
||||
<style type="text/css">
|
||||
body { font-family: Helvetica, sans-serif; }
|
||||
h2, h3 { margin-top:0; }
|
||||
form { margin-top: 15px; }
|
||||
form > input { margin-right: 15px; }
|
||||
#results { float:right; margin:20px; padding:20px; border:1px solid; background:#ccc; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="results">Your captured image will appear here...</div>
|
||||
|
||||
<h1>WebcamJS Test Page</h1>
|
||||
<h3>Demonstrates simple 320x240 capture & display</h3>
|
||||
|
||||
<div id="my_camera"></div>
|
||||
|
||||
<!-- First, include the Webcam.js JavaScript Library -->
|
||||
<script type="text/javascript" src="../webcam.js"></script>
|
||||
|
||||
<!-- Configure a few settings and attach camera -->
|
||||
<script language="JavaScript">
|
||||
Webcam.set({
|
||||
width: 320,
|
||||
height: 240,
|
||||
image_format: 'jpeg',
|
||||
jpeg_quality: 90
|
||||
});
|
||||
Webcam.attach( '#my_camera' );
|
||||
</script>
|
||||
|
||||
<!-- A button for taking snaps -->
|
||||
<form>
|
||||
<input type=button value="Reset" onClick="Webcam.reset()">
|
||||
<input type=button value="Take Snapshot" onClick="take_snapshot()">
|
||||
</form>
|
||||
|
||||
<!-- Code to handle taking the snapshot and displaying it locally -->
|
||||
<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>Here is your image:</h2>' +
|
||||
'<img src="'+data_uri+'"/>';
|
||||
} );
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
65
doc/webcamjs/demos/sfx.html
Normal file
65
doc/webcamjs/demos/sfx.html
Normal file
@@ -0,0 +1,65 @@
|
||||
<!doctype html>
|
||||
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<title>WebcamJS Test Page</title>
|
||||
<style type="text/css">
|
||||
body { font-family: Helvetica, sans-serif; }
|
||||
h2, h3 { margin-top:0; }
|
||||
form { margin-top: 15px; }
|
||||
form > input { margin-right: 15px; }
|
||||
#results { float:right; margin:20px; padding:20px; border:1px solid; background:#ccc; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="results">Your captured image will appear here...</div>
|
||||
|
||||
<h1>WebcamJS Test Page</h1>
|
||||
<h3>Demonstrates simple capture & display with a shutter sound effect</h3>
|
||||
<h3>(Note: Sound implemented using HTML5 Audio, not part of WebcamJS)</h3>
|
||||
|
||||
<div id="my_camera"></div>
|
||||
|
||||
<!-- First, include the Webcam.js JavaScript Library -->
|
||||
<script type="text/javascript" src="../webcam.js"></script>
|
||||
|
||||
<!-- Configure a few settings and attach camera -->
|
||||
<script language="JavaScript">
|
||||
Webcam.set({
|
||||
width: 320,
|
||||
height: 240,
|
||||
image_format: 'jpeg',
|
||||
jpeg_quality: 90
|
||||
});
|
||||
Webcam.attach( '#my_camera' );
|
||||
</script>
|
||||
|
||||
<!-- A button for taking snaps -->
|
||||
<form>
|
||||
<input type=button value="Take Snapshot" onClick="take_snapshot()">
|
||||
</form>
|
||||
|
||||
<!-- Code to handle taking the snapshot and displaying it locally -->
|
||||
<script language="JavaScript">
|
||||
// preload shutter audio clip
|
||||
var shutter = new Audio();
|
||||
shutter.autoplay = false;
|
||||
shutter.src = navigator.userAgent.match(/Firefox/) ? 'shutter.ogg' : 'shutter.mp3';
|
||||
|
||||
function take_snapshot() {
|
||||
// play sound effect
|
||||
shutter.play();
|
||||
|
||||
// take snapshot and get image data
|
||||
Webcam.snap( function(data_uri) {
|
||||
// display results in page
|
||||
document.getElementById('results').innerHTML =
|
||||
'<h2>Here is your image:</h2>' +
|
||||
'<img src="'+data_uri+'"/>';
|
||||
} );
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
BIN
doc/webcamjs/demos/shutter.mp3
Normal file
BIN
doc/webcamjs/demos/shutter.mp3
Normal file
Binary file not shown.
BIN
doc/webcamjs/demos/shutter.ogg
Normal file
BIN
doc/webcamjs/demos/shutter.ogg
Normal file
Binary file not shown.
Reference in New Issue
Block a user