-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtryios.html
51 lines (43 loc) · 1.54 KB
/
tryios.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
<!DOCTYPE html>
<html>
<head>
<title>Hello, WebVR! - A-Frame</title>
<meta name="description" content="Hello, WebVR! - A-Frame">
<meta name="apple-mobile-web-app-capable" content="yes">
</head>
<script src="https://aframe.io/releases/0.5.0/aframe.min.js"></script>
<script src="https://jeromeetienne.github.io/AR.js/aframe/build/aframe-ar.js"></script>
<script type="text/javascript">
var getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia;
var cameraStream;
getUserMedia.call(navigator, {
video: true,
audio: true //optional
}, function (stream) {
/*
Here's where you handle the stream differently. Chrome needs to convert the stream
to an object URL, but Firefox's stream already is one.
*/
if (window.webkitURL) {
video.src = window.webkitURL.createObjectURL(stream);
} else {
video.src = stream;
}
//save it for later
cameraStream = stream;
video.play();
});
</script>
<body style='margin : 0px; overflow: hidden;'>
<video id="video" width="640" height="480" autoplay></video>
<button id="snap">Snap Photo</button>
<canvas id="canvas" width="640" height="480"></canvas>
<a-scene embedded artoolkit='sourceType: webcam;'>
<a-sphere position="0 0.0 0.5" radius="0.5" color="#EF2D5E"></a-sphere>
<a-plane position="0 0 0" rotation="0 0 0" width="1" height="1" color="#7BC8A4"></a-plane>
<a-marker-camera url='./assets/patt.batt'>
</a-marker-camera>
<a-marker-camera preset='hiro'>
</a-marker-camera>
</a-scene>
</body>