forked from futurerealitylab/FutureClassroom
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
127 lines (112 loc) · 4.9 KB
/
index.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
<!DOCTYPE html>
<!--
Copyright 2018 The Immersive Web Community Group
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-->
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
<meta name="mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<link rel="icon" type="image/png" sizes="32x32" href="favicon-32x32.png" />
<link rel="icon" type="image/png" sizes="96x96" href="favicon-96x96.png" />
<link rel="stylesheet" href="css/common.css" />
<title>2022 VR Class</title>
<!-- <script src="https://cdn.jsdelivr.net/npm/resonance-audio/build/resonance-audio.min.js"></script> -->
<script src="js/third-party/resonance-audio.min.js"></script>
<!-- <script src="https://corelink.hpc.nyu.edu/client/browser/corelink.browser.lib.js"></script> -->
<script src="js/third-party/corelink.browser.lib.js"></script>
<!-- this is the library-->
<!-- <script src="https://cdn.plot.ly/plotly-latest.min.js"></script> -->
<!-- <script src="js/third-party/plotly-latest.min.js"></script> -->
<script src="js/buffer-browser.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@mediapipe/camera_utils/camera_utils.js" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/@mediapipe/hands/hands.js" crossorigin="anonymous"></script>
</head>
<body>
<div id=videoElement></div>
<canvas id=anidrawCanvas width=1280 height=960></canvas>
<header id=header>
<details open>
<summary>Welcome to the FutureClassroom!!</summary>
<dev id=messages> </dev>
<!-- <a class="back" href="./">Back</a> -->
</details>
</header>
<!-- <script type="module" src="js/primitive/avatar.js"></script> -->
<!-- <script type="module" src="js/util/voip-webrtc.js"></script> -->
<script type="module" src="js/corelink_handler.js"></script>
<script type="module" src="js/util/corelink_sender.js"></script>
<script type="module" src="js/util/voip-webrtc.js"></script>
<!-- <script type="module" src="js/util/positional-audio.js"></script> -->
<script type="module" src="js/immersive-pre.js"></script>
<div id="audios">
<!-- local audio -->
<audio id="local_webrtc" autoplay></audio>
</div>
<script>
if (! window.vr) {
videoElement.innerHTML = `
<video id="videoFromCamera" autoplay="true"
style="position:absolute;left:-1000px;"
width=640 height=480></video>`;
window.videoFromCamera = document.getElementById('videoFromCamera');
if (navigator.mediaDevices.getUserMedia)
navigator.mediaDevices.getUserMedia({ audio: false, video: true })
.then(function(stream) { videoFromCamera.srcObject = stream; },
function(error ) { console.log(error); });
}
</script>
<script type="module">
if(! window.vr) {
const videoElement = window.videoFromCamera;
window.handInfo = [];
function onResults(results) {
window.handInfo = [];
if (results.multiHandLandmarks) {
let handNum = results.multiHandLandmarks.length;
for (let i = 0; i < handNum; i ++) {
window.handInfo.push({
handedness: results.multiHandedness[i],
landmarks: results.multiHandLandmarks[i],
// worldLandmarks: results.multiHandWorldLandmarks[i],
})
}
}
}
const hands = new Hands({locateFile: (file) => {
return `https://cdn.jsdelivr.net/npm/@mediapipe/hands/${file}`;
}});
hands.setOptions({
maxNumHands: 2,
modelComplexity: 0,
minDetectionConfidence: 0.5,
minTrackingConfidence: 0.5
});
hands.onResults(onResults);
const camera = new Camera(videoElement, {
onFrame: async () => {
await hands.send({image: videoElement});
},
width: 1280,
height: 720
});
camera.start();
}
</script>
</body>
</html>