-
-
Notifications
You must be signed in to change notification settings - Fork 53
/
arNFT_video_example.html
75 lines (65 loc) · 2.81 KB
/
arNFT_video_example.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>ARnft example showing a video</title>
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=0.5, maximum-scale=1">
<link rel="stylesheet" href="css/nft-style.css">
</head>
<body>
<a href="https://raw.githubusercontent.com/artoolkitx/artoolkit5/master/doc/Marker%20images/pinball.jpg"
class="ui marker" target="_blank">
🖼 Marker Image
</a>
<video loop autoplay muted webkit-playsinline playsinline crossOrigin="anonymous" id="arvideo">
<source src="https://avo-content-dev.s3.amazonaws.com/videos/bg_1588085276090.mp4" type='video/mp4'>
</video>
<script src="js/third_party/three.js/three.min.js"></script>
<script src="js/ARnftThreejs.js"></script>
<script src="../dist/ARnft.js"></script>
<script>
let width = 640;
let height = 480;
ARnft.ARnft.init(width, height, [["examples/DataNFT/pinball"]], [['pinball']], 'config.json', true)
.then((nft) => {
document.addEventListener('containerEvent', function (ev) {
let canvas = document.getElementById('canvas');
let fov = 0.8 * 180 / Math.PI;
let ratio = width / height;
let config = {
"renderer": {
"alpha": true,
"antialias": true,
"context": null,
"precision": "mediump",
"premultipliedAlpha": true,
"stencil": true,
"depth": true,
"logarithmicDepthBuffer": true
},
"camera": {
"fov": fov,
"ratio": ratio,
"near": 0.01,
"far": 1000
}
}
let sceneThreejs = new ARnftThreejs.SceneRendererTJS(config, canvas, nft.uuid,
true);
sceneThreejs.initRenderer();
let nftAddTJS = new ARnftThreejs.NFTaddTJS(nft.uuid);
// Set width, height and width and height number of segments of the PlaneGeometry.
let imgConfig = {w: 1, h: 1, ws: 1, hs: 1};
nftAddTJS.addVideo('arvideo', 'pinball', 180, imgConfig, false);
const tick = () => {
sceneThreejs.draw();
window.requestAnimationFrame(tick)
}
tick()
})
}).catch((error) => {
console.log(error);
});
</script>
</body>
</html>