forked from MyYosun/mxreality.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pano_video.html
86 lines (68 loc) · 2.2 KB
/
pano_video.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
<!DOCTYPE html>
<html lang="en">
<head>
<title>测试视频</title>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<style>
#example {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
</style>
</head>
<body>
<div id="example"></div>
<script src="../build/three.js"></script>
<script src="../build/mxreality.js"></script>
<script>
window.onload=function () {
init();
}
//var vr=new VR(scene,renderer,container);
function init() {
var scene, renderer;
var container;
//renderer = new THREE.WebGLRenderer();
AVR.debug=true;
if( !AVR.Broswer.isIE() && AVR.Broswer.webglAvailable() ) {
renderer = new THREE.WebGLRenderer();
}else {
renderer = new THREE.CanvasRenderer();
}
renderer.setPixelRatio( window.devicePixelRatio );
container = document.getElementById('example');
container.appendChild(renderer.domElement);
scene = new THREE.Scene();
var vr=new VR(scene,renderer,container,{"fov":50});
//vr.playText="<img src='img/play90.png' width='40' height='40'/>";
vr.vrbox.radius=600;
if(AVR.isCrossScreen()) {
vr.effect.separation=1.2;
}
vr.loadProgressManager.onLoad=function () {
}
//AVR.useGyroscope=false;
vr.init(function () {
});
vr.playPanorama('/examples/frag_bunny.mp4',vr.resType.video);
vr.video.setAttribute("loop","loop");
vr.video.crossOrigin="*";
vr.video.onended=function () {
}
window.addEventListener('resize', function () {
var isHuawei=navigator.userAgent.match(/;\sHUAWEI\s[a-zA-Z0-9\-]+\sBuild\//);
if (AVR.OS.isWeixin() && !AVR.OS.isiOS() && isHuawei) {
if (vr.video.getAttribute('x5-video-orientation') == "landscape") {
vr.toolBar.toolbar.style.width = document.body.clientWidth + "px";
} else {
vr.toolBar.toolbar.style.width = "100%";
}
}
})
}
</script>
</body>
</html>