-
Notifications
You must be signed in to change notification settings - Fork 1
/
usingCamera.html
43 lines (40 loc) · 1.36 KB
/
usingCamera.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Using Camera</title>
<link rel="stylesheet" href="css/BlackBerry-JQM-all.min.css" />
<script src="js/BlackBerry-JQM-all.min.js"></script>
<script src="local:///chrome/webworks.js" type="text/javascript"></script>
</head>
<body>
<div data-role="page">
<div data-role="header" data-position="fixed">
<h1>Using Camera</h1>
</div>
<div data-role="content">
<video autoplay controls></video>
<script type="text/javascript">
function onFailSoHard(ex) {
console.log(ex);
}
navigator.getUserMedia = navigator.getUserMedia||navigator.webkitGetUserMedia||false;
if(!!navigator.getUserMedia) {
navigator.getUserMedia({audio: true, video: true}, function(stream) {
var video = document.querySelector('video');
video.src = ('webkitURL' in window)?window.webkitURL.createObjectURL(stream):stream;
}, onFailSoHard);
} else {
alert("not supported"); // fallback.
}
</script>
</div>
<!--/content-->
<div data-role="footer" data-position="fixed">
<div id="action-bar-area" data-role="actionbar">
<div data-role="back"></div>
</div>
</div>
</div>
</body>
</html>