-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtestvid.html
40 lines (40 loc) · 1.51 KB
/
testvid.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
<html>
<head>
<meta name="apple-mobile-web-app-capable" content="yes">
<script src="https://aframe.io/releases/1.0.4/aframe.min.js"></script>
<!-- we import arjs version without NFT but with marker + location based support -->
<script src="https://raw.githack.com/AR-js-org/AR.js/master/aframe/build/aframe-ar.js"></script>
<script>
AFRAME.registerComponent('vidhandler', {
init: function() {
this.toggle = false;
this.vid = document.querySelector("#vid");
this.vid.pause();
},
tick: function() {
if (this.el.object3D.visible == true) {
if (!this.toggle) {
this.toggle = true;
this.vid.play();
}
} else {
this.toggle = false;
this.vid.pause();
this.vid.currentTime = 0;
}
}
});
</script>
</head>
<body style="margin : 0px; overflow: hidden;">
<a-scene embedded arjs>
<a-assets>
<video preload="auto" id="vid" response-type="arraybuffer" loop="true" crossorigin webkit-playsinline playsinline controls src="Water/slim.mp4">
</a-assets>
<a-marker type="pattern" url="smoothie-peque/pattern-smoothie-peque.patt" vidhandler>
<a-plane position='0 0.1 0' rotation="-90 0 0" material='transparent:true;src:#vid' controls></a-plane>
</a-marker>
<a-entity camera></a-entity>
</a-scene>
</body>
</html>