-
Notifications
You must be signed in to change notification settings - Fork 0
/
VRiframe.html
247 lines (185 loc) · 13.9 KB
/
VRiframe.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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
<!DOCTYPE html>
<head style="width:100%;height:100%'>
<meta charset="UTF-8">
<!-- Initialize the viewport -->
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<link rel="icon" type="image/x-icon" href="data:image/x-icon;base64,AAABAAEAAAAAAAEAIAAdFAAAFgAAAIlQTkcNChoKAAAADUlIRFIAAAEAAAABAAgAAAAAeRn3ugAAE+RJREFUeNrtnWmUHMWRx/+RWX3NfSEhIRCSQCwGhMRDHOIQsjjEueK+LAyCRSvAgHgGvBi0PMCyucwzGPQkDCz4sQu2Ocy5uxxPAoEuhO77QBpdCM2hObunuzJjP8z0THdPVXV192BbS9YXBroqK/KXEZGRkVEJMX7Yl/iB998AMAAMAAPAADAADAADwAAwAAwAA8AAMAAMAAPAADAADAADwAAwAAwAA8AAMAAMAAPAADAADAADwAAwAAwAA8AAMAAMAAPAADAADAADwAAwAAwA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fXPwAAAAASUVORK5CYII=">
<style>
.column {
float: left;
width: 50%;
}
/* Clear floats after the columns */
.row:after {
content: "";
display: table;
clear: both;
}
#iframeA, #iframeB{ height: 80%; width:30%; margin-top: 25px; position:absolute;}/* width = important to alter sight! */
#iframeA{ margin-left: 2px;}
#iframeB{ right:0; margin-right: 2px; }
#btnFScreen{ position: absolute;
top: 25%; margin-left:48%; background-color:black; color:slategrey;
}
</style>
</head>
<body id="body" style='margin : 0px; overflow: hidden;width:100%;width:100%;' > <!-- ref: https://skarredghost.com/2019/08/29/how-to-seamless-mobile-ar-js/ & https://levelup.gitconnected.com/simple-augmented-reality-ar-integration-with-a-frame-f625e9dc66b8 -->
<div class="row">
<div class="column">
<iframe id="iframeA" src="/iframe" > </iframe>
</div>
<input onclick="openFullscreen()" id="btnFScreen" type="button" value="FS"/>
<div class="column">
<iframe id="iframeB" src="/iframe" > </iframe>
</div>
</div>
</div>
<script>
var isRemoveFrameA=true;
function hideOneMarker()// show content on one eye
{
document.getElementById("iframeA").addEventListener("load", function() {
var elmnt= document.getElementById("iframeA").contentWindow.document.getElementById("iFrameSimulated") ;
elmnt.remove();
});
}
function removeRangeSliders()
{
document.getElementById("iframeA").addEventListener("load", function() {
document.getElementById("iframeA").contentWindow.document.getElementById("rOffsetHorizontal").remove();
document.getElementById("iframeA").contentWindow.document.getElementById("rOffsetVertical").remove();
});
document.getElementById("iframeB").addEventListener("load", function() {
document.getElementById("iframeB").contentWindow.document.getElementById("rOffsetHorizontal").remove();
document.getElementById("iframeB").contentWindow.document.getElementById("rOffsetVertical").remove();
});
}
function removeBorderFromFrames(isRemoveSubBorders,isRemoveFrameA)
{
document.getElementById("iframeA").addEventListener("load", function() {
if( !isRemoveFrameA ){
document.getElementById("iframeA").frameBorder = 0;
if(isRemoveSubBorders ){
document.getElementById("iframeA").contentWindow.document.getElementById("iFrameSimulated").frameBorder = 0;
}
}
});
document.getElementById("iframeB").addEventListener("load", function() {
document.getElementById("iframeB").frameBorder = 0;
if(isRemoveSubBorders){
document.getElementById("iframeB").contentWindow.document.getElementById("iFrameSimulated").frameBorder = 0;
}
});
}
function hideBtnsInsideFrames()
{
document.getElementById("iframeA").addEventListener("load", function() {
document.getElementById("iframeA").contentWindow.document.getElementById("btnFScreen").style.opacity="0.0";
});
document.getElementById("iframeB").addEventListener("load", function() {
document.getElementById("iframeB").contentWindow.document.getElementById("btnFScreen").style.opacity="0.0";
});
}
</script>
<script>
function getUserMedia(constraints) {
// if Promise-based API is available, use it
if (navigator.mediaDevices) {
return navigator.mediaDevices.getUserMedia(constraints);
}
// otherwise try falling back to old, possibly prefixed API...
var legacyApi = navigator.getUserMedia || navigator.webkitGetUserMedia ||
navigator.mozGetUserMedia || navigator.msGetUserMedia;
if (legacyApi) {
// ...and promisify it
return new Promise(function (resolve, reject) {
legacyApi.bind(navigator)(constraints, resolve, reject);
});
}
}
function getStream (type) { //REF:https://whatwebcando.today/camera-microphone.html & https://whatwebcando.today/permissions.html
if (!navigator.mediaDevices && !navigator.getUserMedia && !navigator.webkitGetUserMedia &&
!navigator.mozGetUserMedia && !navigator.msGetUserMedia) {
alert('User Media API not supported.');
return;
}
/*
var constraints = {};
constraints[type] = true;
getUserMedia(constraints)
.then(function (stream) {
const tracks = stream.getTracks();
tracks.forEach(track => track.stop());
var mediaControl = document.querySelector(type);
if ('srcObject' in mediaControl) {
mediaControl.srcObject = stream;
} else if (navigator.mozGetUserMedia) {
mediaControl.mozSrcObject = stream;
} else {
mediaControl.src = (window.URL || window.webkitURL).createObjectURL(stream);
}
mediaControl.play();
})
.catch(function (err) {
console.log('Error: ' + err);
});
*/
navigator.permissions.query({name: 'microphone'})
.then((permissionObj) => {
console.log(permissionObj.state);
})
.catch((error) => {
console.log('Got error :', error);
})
navigator.permissions.query({name: 'camera'})
.then((permissionObj) => {
console.log(permissionObj.state);
})
.catch((error) => {
console.log('Got error :', error);
})
}
document.addEventListener("DOMContentLoaded", function(event) {
getStream('video');
if(isRemoveFrameA)
{
hideOneMarker();
}
removeBorderFromFrames(true,isRemoveFrameA);
hideBtnsInsideFrames();
removeRangeSliders();
});
</script>
<script>
var feed=window.location.pathname.replace("vrframe","").trim(); // IMPORTANT it's possible to do (so it has the same functions as with the /iframe) : https://192.168.1.40:4444/vrframeiframe?https:///aikido-torhout.be|/static/scanables/pattern-Skarredghost_marker.patt
if(feed.length >1)
{
document.getElementById('iframeA').src = window.location.href.replace(window.location.pathname,feed);
setTimeout(function(){ document.getElementById('iframeB').src = window.location.href.replace(window.location.pathname,feed);}, 5000,feed);
console.log(window.location.href.replace(window.location.pathname,feed))
}
</script>
<script>
/* Get the element you want displayed in fullscreen mode (a video in this example): */
/* When the openFullscreen() function is executed, open the video in fullscreen.
Note that we must include prefixes for different browsers, as they don't support the requestFullscreen method yet */
function openFullscreen() {
var elem = document.getElementById("body");
if (!document.fullscreenElement) {
if (elem.requestFullscreen) {
elem.requestFullscreen();
} else if (elem.webkitRequestFullscreen) { /* Safari */
elem.webkitRequestFullscreen();
} else if (elem.msRequestFullscreen) { /* IE11 */
elem.msRequestFullscreen();
}
btnFScreen.style.display = "none";
}
}
setInterval(function () {
if((!window.fullScreen) && (window.innerWidth !== screen.width && window.innerHeight !== screen.height)) {// not fullscreen
btnFScreen.style.display = "block";
}
}, 1000);
</script>
</body>