-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.html
171 lines (132 loc) · 5.07 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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Meta -->
<meta charset="UTF-8" />
<title>GUI Experiments 2019</title>
<!-- Styles -->
<link rel="stylesheet" href="styles/index.css">
</head>
<body onload="loadInterface()">
<div class="wrapper">
<div class="content">
<svg class="workspace" id="workspace">
</svg>
</div>
</div>
<!-- Scripts -->
<script src="scripts/dat.gui.min.js"></script>
<script>
var InterfaceTest = function() {
this.testtype='Arrows';
this.audioinput='';
this.videoinput='';
this.speech = false;
this.radiusA = 0.8;
this.radiusB= 0.8;
this.trajectory = false;
this.stopaudio = function() {
};
this.stopvideo = function() {
stopCam();
};
};
window.addEventListener( 'load', init );
var element = new InterfaceTest();
var gui = new dat.GUI();
gui.domElement.id = 'gui';
var audioInputs = ['a1'];
var videoInputs = ['v1'];
var AudioInputSelect= gui.add(element, 'audioinput',audioInputs);
var VideoInputSelect= gui.add(element, 'videoinput',videoInputs);
function init() {
var testControl =gui.add(element, 'testtype',
{Arrows: 0, Drag: 1, Fitts: 2, FittsTriangleAngle: 3, Target: 4, CardinalSpeech: 5,
TrajectorySpeech: 6,GridSpeech:7,VirtualTrackpad:8,
MouseTrajs:9, TensorflowClassify:10, TensorflowRegNN:10, Keyboard: 12} );
AudioInputSelect.domElement.id = 'audioSource';
VideoInputSelect.domElement.id = 'videoSource';
gui.add(element, 'stopaudio').name("Mute Audio");
gui.add(element, 'stopvideo').name("Stop Video");
var speechFolder = gui.addFolder('Speech Controls');
var speechControl =speechFolder.add(element, 'speech' );
var trajFolder = gui.addFolder('Trajectory Controls');
var trajRadiusAControl = trajFolder.add(element, 'radiusA', -5, 5);
var trajRadiusBControl = trajFolder.add(element, 'radiusB', -5, 5);
var trajDisplayOptions =trajFolder.add(element, 'trajectory' );
gui.open();
navigator.mediaDevices.enumerateDevices()
.then(gotDevices);
testControl.onFinishChange(function(value) {
clearWorkspace();
createEE(value);
if (value<4){
// hidden
speechFolder.domElement.setAttribute("hidden", true);
} else{
// visible
speechFolder.domElement.removeAttribute("hidden");
}
if(value == 7){
// visible
trajFolder.domElement.removeAttribute("hidden");
}else {
// hidden
trajFolder.domElement.setAttribute("hidden", true);
}
})
trajRadiusAControl.onFinishChange(function(value) {
selRaVal();
})
trajRadiusBControl.onFinishChange(function(value) {
selRbVal();
})
trajDisplayOptions.onFinishChange(function(value) {
showtrajOpts();
})
VideoInputSelect.onFinishChange(function(value) {
changeCam(value);
//alert(this.__select.selectedOptions[0].text);
})
}
function gotDevices(deviceInfos) {
var audioInnerHTMLStr = "";
var videoInnerHTMLStr = "";
for (var i = 0; i !== deviceInfos.length; ++i) {
var deviceInfo = deviceInfos[i];
var labelA = "";
var labelV = "";
if (deviceInfo.kind === 'audioinput') {
labelA = deviceInfo.label ||
'microphone ' + (audioSelect.length + 1);
var str = "<option value='" + deviceInfo.deviceId + "'>" + labelA + "</option>";
audioInnerHTMLStr += str;
} else if (deviceInfo.kind === 'videoinput') {
labelV = deviceInfo.label || 'camera ' +
(videoSelect.length + 1);
var str = "<option value='" + deviceInfo.deviceId + "'>" + labelV + "</option>";
videoInnerHTMLStr += str;
} else {
console.log('Found one other kind of source/device: ', deviceInfo);
}
}
if (audioInnerHTMLStr != ""){
AudioInputSelect.domElement.children[0].innerHTML = audioInnerHTMLStr;
}
if (videoInnerHTMLStr!= ""){
VideoInputSelect.domElement.children[0].innerHTML= videoInnerHTMLStr;
}
}
</script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="scripts/annyang.min.js"></script>
<!--<script src="https://cdnjs.cloudflare.com/ajax/libs/annyang/2.6.0/annyang.min.js"></script>-->
<script src="scripts/ee.js"></script>
<script src="scripts/index.js"></script>
<script src="scripts/cardinalSpeech.js"></script>
<script src="scripts/gridSpeech.js"></script>
<script src="scripts/grid.js"></script>
<script src="scripts/trajSpeech.js"></script>
<!--<script src="scripts/google_speech.js"></script>-->
</body>
</html>