-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.htm
197 lines (166 loc) · 8.15 KB
/
index.htm
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
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="Virtual Tour"/>
<script>(function(i,s,o,g,r,a,m){i["GoogleAnalyticsObject"]=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,"script","//www.google-analytics.com/analytics.js","ga");ga("create", "UA-116087-1", "auto"); ga("send", "pageview");</script>
<title>Panorama_test_001</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="user-scalable=no, initial-scale=0.5, width=device-width" />
<script src="lib/tdvplayer.js"></script>
<script type="text/javascript">
var player;
var playersPlayingTmp = [];
var isInitialized = false;
function loadTour()
{
if(isInitialized)
return;
isInitialized = true;
var beginFunc = function(event){
if(event.name == 'begin')
{
var camera = event.data.source.get('camera');
if(camera && camera.get('initialSequence') && camera.get('initialSequence').get('movements').length > 0)
return;
}
player.unbindOnObjectsOf('PanoramaPlayListItem', 'begin', beginFunc, player, true);
player.unbind('stateChange', beginFunc, player, true);
window.parent.postMessage("tourLoaded", '*');
disposePreloader();
};
var settings = new TDV.PlayerSettings();
settings.set(TDV.PlayerSettings.CONTAINER, document.getElementById('viewer'));
settings.set(TDV.PlayerSettings.SCRIPT_URL, 'script.js');
settings.set(TDV.PlayerSettings.FLASH_EXPRESS_INSTALLER_URL, 'lib/ExpressInstall.swf');
settings.set(TDV.PlayerSettings.FLASH_AUDIO_PLAYER_URL, 'lib/AudioPlayer.swf');
settings.set(TDV.PlayerSettings.FLASH_PANORAMA_PLAYER_URL, 'lib/PanoramaRenderer.swf');
settings.set(TDV.PlayerSettings.THREE_JS_WEBGL_URL, 'lib/ThreeWebGL.js');
settings.set(TDV.PlayerSettings.WEBVR_POLYFILL_URL, 'lib/WebVRPolyfill.js');
settings.set(TDV.PlayerSettings.HLS_URL, 'lib/Hls.js');
window.tdvplayer = player = TDV.PlayerAPI.create(settings);
player.bind('stateChange', beginFunc, player, true);
player.bindOnObjectsOf('PanoramaPlayListItem', 'begin', beginFunc, player, true);
player.bindOnObject('rootPlayer', 'start', function(e){
var rootPlayer = player.getById('rootPlayer');
var queryDict = {}; location.search.substr(1).split("&").forEach(function(item) {var k = item.split("=")[0], v = decodeURIComponent(item.split("=")[1]);queryDict[k] = v});
if("media-index" in queryDict){
rootPlayer.setMainMediaByIndex(parseInt(queryDict["media-index"]) - 1);
}
else if("media-name" in queryDict){
rootPlayer.setMainMediaByName(queryDict["media-name"]);
}
}, player, false);
/* Listen messages */
window.addEventListener('message', function (e) {
//Listen to messages for make actions to player in the format function:param1,param2
var action = e.data;
if (action == 'pauseTour' || action == 'resumeTour') {
this[action].apply(this);
}
});
}
function pauseTour()
{
var playLists = player.getByClassName('PlayList');
for(var i = 0, count = playLists.length; i<count; i++)
{
var playList = playLists[i];
var index = playList.get('selectedIndex');
if(index != -1)
{
var item = playList.get('items')[index];
var itemPlayer = item.get('player');
if(itemPlayer && itemPlayer.pause)
{
playersPlayingTmp.push(itemPlayer);
itemPlayer.pause();
}
}
}
player.getById('pauseGlobalAudios')();
}
function resumeTour()
{
while(playersPlayingTmp.length)
{
var viewer = playersPlayingTmp.pop();
viewer.play();
}
player.getById('resumeGlobalAudios')();
}
function showPreloader()
{
var preloadContainer = document.getElementById('preloadContainer');
preloadContainer.style.opacity = 1;
}
function disposePreloader()
{
var transitionEnd = transitionEndEventName();
var preloadContainer = document.getElementById('preloadContainer');
var transitionEndName = transitionEndEventName();
if(transitionEndName)
{
preloadContainer.addEventListener(transitionEnd, hide, false);
preloadContainer.style.opacity = 0;
}
else
{
hide();
}
function hide()
{
preloadContainer.style.visibility = 'hidden';
preloadContainer.style.display = 'none';
}
function transitionEndEventName () {
var i,
undefined,
el = document.createElement('div'),
transitions = {
'transition':'transitionend',
'OTransition':'otransitionend',
'MozTransition':'transitionend',
'WebkitTransition':'webkitTransitionEnd'
};
for (i in transitions) {
if (transitions.hasOwnProperty(i) && el.style[i] !== undefined) {
return transitions[i];
}
}
return undefined;
}
}
function onBodyClick(){
document.body.removeEventListener("click", onBodyClick);
document.body.removeEventListener("touchend", onBodyClick);
loadTour();
}
function onLoad() {
if (isOVRWeb()){
showPreloader();
loadTour();
return;
}
if(isMobileOrTablet()){
}
showPreloader();
loadTour()
}
function isMobileOrTablet(){
return /iPhone|iPad|iPod|Android/i.test(navigator.userAgent);
}
function isOVRWeb(){
return window.location.hash.substring(1).split('&').indexOf('ovrweb') > -1;
}
</script>
<style type="text/css">
html, body { background-color: #333333; width: 100%; height: 100%; margin: 0; padding: 0; }
#viewer { background-color: #333333; z-index:1; position:absolute; width: 100%; height: 100%; top: 0; }
#preloadContainer { z-index:2; position:relative; width:100%; height:100%; transition: opacity 1s; -webkit-transition: opacity 1s; -moz-transition: opacity 1s; -o-transition: opacity 1s;}
</style>
</head>
<body onload="onLoad()">
<div id="preloadContainer" style="background-color:rgba(51,51,51,0.97)"><div style="z-index: 4; position: absolute; left: 0%; top: 50%; width: 100.00%; height: 10.00%"><div style="text-align:left; color:#000; "><DIV STYLE="text-align:center;"><SPAN STYLE="letter-spacing:0px;color:#777777;font-size:14px;font-family:Arial, Helvetica, sans-serif;"><SPAN STYLE="font-size:28px;">Loading. Please wait...</SPAN></SPAN></DIV><p STYLE="margin:0; line-height:12px;"><BR STYLE="letter-spacing:0px;color:#888888;font-size:12px;font-family:'Segoe UI';"/></p></div></div></div>
<div id="viewer"></div>
</body>
</html>