-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmedia-capture.html
82 lines (72 loc) · 2.35 KB
/
media-capture.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta charset="UTF-8">
<title> HTML Media Capture</title>
<!-- Le styles -->
<link href="css/bootstrap.css" rel="stylesheet">
<link href="css/custom.css" rel="stylesheet">
<link href="css/bootstrap-responsive.css" rel="stylesheet">
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="index.html">Device APIs demos</a>
<div class="nav-collapse collapse">
<ul class="nav">
<li class="active"><a href="index.html">Home</a></li>
<li><a href="about.html">About/Contact</a></li>
</ul>
</div><!--/.nav-collapse -->
</div>
</div>
</div>
<!-- Important bit starts HERE -->
<div class="container">
<div class="row-fluid">
<div class="span12"><p class="lead">Capturing snaps from the device's camera</p> </div>
</div>
<div class="row-fluid">
<div class="span12">
<p>Select media from the camera, camcorder, microphone or filesystem</p>
</div>
</div>
<div class="row-fluid">
<div class="span12">
<input id="picker" type="file" accept="image/*;capture=camera" multiple>
</div>
</div>
<div class="row-fluid">
<div id="grid" class="span12">
</div>
</div>
</div>
</div>
<script type="text/javascript">
var picker = document.getElementById('picker');
picker.addEventListener("change", displayFiles, false);
function displayFiles() {
for (var i=0; i<picker.files.length; i++) {
var fr= new FileReader();
fr.onload = function (event) {
var img = document.createElement('img');
img.setAttribute('class','img-polaroid');
img.file = event.target.result;
img.setAttribute('width', '150');
img.setAttribute('height', '100');
document.getElementById('grid').appendChild(img);
img.src = event.target.result;
};
fr.readAsDataURL(picker.files[i]);
}
}
</script>
</body>
</html>