-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvideoAR.html
72 lines (71 loc) · 2.4 KB
/
videoAR.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
<html lang="en">
<head>
<meta name="apple-mobile-web-app-capable" content="yes" />
<script src="https://aframe.io/releases/0.9.2/aframe.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/donmccurdy/[email protected]/dist/aframe-extras.min.js"></script>
<script src="https://raw.githack.com/jeromeetienne/AR.js/1.7.5/aframe/build/aframe-ar.js"></script>
<title>KPMG Blue Ocean Gin AR</title>
</head>
<body>
<a-scene
embedded
arjs="
debugUIEnabled: false;
patternRatio: .87;
sourceType: webcam;
detectionMode: mono;
maxDetectionRate: 30;
canvasWidth: 240;
canvasHeight: 180"
loading-screen="dotsColor: white; backgroundColor: #005EB8;"
vr-mode-ui="enabled: false"
>
<a-assets timeout="6000">
<video
preload="auto"
crossorigin="anonymous"
id="video-test"
src="./assets/video/KPMG_ARVideo_V2.mp4"
></video>
<img id="play-button" src="./assets/icons/Play01.png">
</a-assets>
<a-marker-camera
id="marker"
eventhandler
cursor="rayOrigin: mouse;"
emitevents="true"
type="pattern"
url="./assets/patterns/pattern-QR_Marker.patt"
fuse="false"
>
<a-video
class="clickable"
visible="false"
width="1"
height="2"
rotation="-90"
src="#video-test"
></a-video>
<a-plane class="clickable" src="#play-button" width="1" height="1" rotation="-90" position="0 1 0"></a-plane>
</a-marker-camera>
</a-scene>
<script>
AFRAME.registerComponent('eventhandler', {
init: function() {
var marker = document.querySelector('#marker')
var video = document.querySelector('video')
var sceneVideo = document.querySelector('a-video')
var playButton = document.querySelector('a-plane')
marker.addEventListener('click', function(ev, target) {
var intersected = ev && ev.detail && ev.detail.intersectedEl
if(playButton && intersected === playButton || sceneVideo && intersected === sceneVideo){
sceneVideo.setAttribute('visible', 'true')
playButton.setAttribute('visible', 'false')
video.play()
}
})
}
})
</script>
</body>
</html>