-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathboth.html
More file actions
68 lines (68 loc) · 2.88 KB
/
both.html
File metadata and controls
68 lines (68 loc) · 2.88 KB
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
<html>
<head>
<meta name="viewport" content="width=device-width">
</head>
<body style="text-align: center; background-color: black">
<img src=http://c1/babycam/out.jpg id='cameraview2'>
<img src=http://c2/babycam/out.jpg id='cameraview1'>
<script>
var iOS = !!navigator.platform && /iPad|iPhone|iPod/.test(navigator.platform);
var isHorizontal=false
function updateCamera()
{
if(isHorizontal)
{
document.getElementById('cameraview2').src="http://c2/babycam/out.jpg?T="+Math.random();
document.getElementById('cameraview1').src="http://c1/babycam/out.jpg?T="+Math.random();
}
else
{
document.getElementById('cameraview1').src="http://c2/babycam/out.jpg?T="+Math.random();
document.getElementById('cameraview2').src="http://c1/babycam/out.jpg?T="+Math.random();
}
setTimeout(updateCamera,200);
}
function doOnOrientationChange() {
switch(window.orientation) {
case -90: case 90:
isHorizontal=true;
//alert(document.documentElement.clientWidth)
//var resFactor=(document.documentElement.clientWidth/(640*2))
//if(document.documentElement.clientWidth < 1000)
var iPhone = !!navigator.platform && /iPhone/.test(navigator.platform);
if(iPhone)
resFactor=0.61;
else
resFactor=0.784;
newW=640*resFactor;
newH=480*resFactor;
document.getElementById('cameraview1').style.width=newW;
document.getElementById('cameraview1').style.height=newH;
document.getElementById('cameraview2').style.width=newW;
document.getElementById('cameraview2').style.height=newH;
/*
document.getElementById('cameraview1').style.width="320";
document.getElementById('cameraview1').style.height="240";
document.getElementById('cameraview2').style.width="320";
document.getElementById('cameraview2').style.height="240";
*/
break;
default:
isHorizontal=false;
document.getElementById('cameraview1').style.width="640";
document.getElementById('cameraview1').style.height="480";
document.getElementById('cameraview2').style.width="640";
document.getElementById('cameraview2').style.height="480";
//alert('portrait');
break;
}
}
setTimeout(function(){
updateCamera();
}, 5*1000);
window.addEventListener('orientationchange', doOnOrientationChange);
// Initial execution if needed
doOnOrientationChange();
</script>
</body>
</html>