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
|
<krpano onstart="">
<plugin name="editor" url="../plugins/editor.swf" keep="true" />
<include url="contextmenu.xml" />
<include url="html5sound/xmls/init.xml" />
<!-- webvr.xml - WebVR plugin, enter/exit VR buttons, VR cursor, VR setup -->
<include url="%SWFPATH%/plugins/webvr.xml" />
<!-- include the videoplayer interface / skin (with VR support) -->
<include url="%SWFPATH%/skin/videointerface.xml" />
<!-- add/overwrite some settings from the webvr.xml for this example
- enable the fake mode
- add events for portrait usage
-->
<plugin name="WebVR"
mobilevr_fake_support="true"
onentervr="webvr_onentervr(); webvr_act_as_gyro_in_portrait_mode(true);"
onexitvr="webvr_onexitvr(); tween(layer[webvr_rotate_to_landscape_request].alpha, 0.0, 0.0);"
/>
<!-- re-align the vr button and 'auto-start' the video when pressing the enterVR button -->
<layer name="webvr_enterbutton"
align="bottom" y="10%"
ondown="video_touch_auto_start();"
/>
<!-- show a 'rotate the device' info when the mobile device is in portrait orientation in VR mode -->
<layer name="webvr_rotate_to_landscape_request" keep="true" vr="true" devices="mobile"
url="rotate_device.png" scale="0.5"
align="top" edge="center" y="28%"
autoalpha="true" alpha="0.0"
enabled="false"
/>
<events name="webvr_events" keep="true" devices="html5"
onresize.mobile="webvr_act_as_gyro_in_portrait_mode();"
/>
<action name="webvr_act_as_gyro_in_portrait_mode">
if(device.mobile AND webvr.isenabled,
div(aspect, stagewidth, stageheight);
if(aspect != lastaspect OR '%1' == 'true',
copy(lastaspect, aspect);
if(stagewidth GT stageheight,
<!-- landscape orientation - use stereo rendering and a direct/fast gyro sensor mode -->
set(display.stereo, true);
set(webvr.mobilevr_sensor_mode, 3);
webvr.update();
tween(layer[webvr_rotate_to_landscape_request].alpha, 0.0, 0.0);
,
<!-- portrait orientation - use normal rendering and a smoother/slower gyro sensor mode -->
set(display.stereo, false);
set(webvr.mobilevr_sensor_mode, 1);
webvr.update();
tween(layer[webvr_rotate_to_landscape_request].alpha, 1.0);
delayedcall(3.0, tween(layer[webvr_rotate_to_landscape_request].alpha, 0.0, 1.0); );
);
);
,
set(lastaspect, 0);
);
</action>
<!-- allow scene switching by the PageUp/PageDown keys -->
<events name="keybcontrol" keep="true" onkeyup="if(keycode == 33, nextscene_loop(-1)); if(keycode == 34, nextscene_loop(+1));" />
<!-- the intro pano image -->
<view fovtype="VFOV" fov="90" fovmin="40" fovmax="150" />
<preview url="panos/intro/preview.jpg" />
<image>
<sphere url="plugin:video" />
</image>
<plugin name="video"
url.html5="plugins/videoplayer.js"
url.flash="plugins/videoplayer.swf"
pausedonstart="true"
loop="false"
touchworkarounds = "true"
volume="1.0"
onloaded="add_video_sources(); startIt();"
onvideoready=""
onvideoplay="playSounds()"
onvideopaused="pauseSounds()"
onvideocomplete="load_video_2();"
/>
<action name="load_video_2">
changepano( loadpanoscene('2.xml', 0, null, NOPREVIEW|MERGE|KEEPVIEW|KEEPMOVING, BLEND(0.2)); );
</action>
<action name="add_video_sources">
videointerface_addsource('1024x512', 'videos/Intro_1K.mp4|videos/Intro_1K.webm|videos/iphone-audio.mp3', 'videos/poster_1k.jpg');
videointerface_addsource('2048x1024', 'videos/Intro_2K.mp4|videos/Intro_2K.webm|videos/iphone-audio.mp3', 'videos/poster_2k.jpg');
videointerface_addsource('4096x2048', 'videos/Intro_4K.mp4|videos/Intro_4K.webm|videos/iphone-audio.mp3', 'videos/poster_4k.jpg');
if(device.ios,
<!-- iOS Safari has a very slow 'video-to-webgl-texture' transfer, therefore use a low-res video by default -->
videointerface_play('1024x512');
,
videointerface_play('2048x1024');
);
set(plugin[video].onvideocomplete, load_video_2();)
</action>
<events onremovepano="
set(skin_video_setup_done, false);
videosources.removearrayitem('v1024x512');
videosources.removearrayitem('v2048x1024');
videosources.removearrayitem('v4096x2048');
" />
<events name="video_events" keep="true"
onmousedown="video_touch_auto_start();"
onremovepano="if(xml.scene != video_scene, plugin[video].seek(0); plugin[video].pause(); );"
/>
<events name="start_video" keep="false" devices="html5"
onxmlcomplete=""
/>
<action name="video_touch_auto_start">
if(video_touch_auto_start_called !== true,
if(plugin[video].ispaused,
plugin[video].play();
delayedcall(0.1, plugin[video].pause() );
set(events[video_events].onmousedown, null);
set(video_touch_auto_start_called, true);
);
);
</action>
<scene name="start" onstart="">
<image>
<sphere url="plugin:video" />
</image>
</scene>
<!-- SPECIAL CASE END -->
<!--
*** AUDIO ***
INFO:
playHtml5sound3D(keep,name, audiofile, ath, atv, range, rate*,volume*, loops*, onload*,onplay*,onpause*,onstop*,onmute*, oncomplete*);
playHtml5sound2D(keep,name, audiofile, rate*,volume*,loops*, onload*,onplay*,onpause*,onstop*,onmute*, oncomplete*);
-->
<action name="startIt">
plugin[video].play();
AudioScene1()
</action>
<action name="AudioScene1">
playHtml5sound3D(false, Anmoderation, html5sound/assets/Anmoderation, -1, -2, 120, 1.0, 1.0, false);
trace('sounds loaded');
</action>
<action name="pauseSounds">
Html5Soundpause(Anmoderation);
trace('sounds paused');
</action>
<action name="playSounds">
Html5Soundplay(Anmoderation);
trace('sounds played');
</action>
<events onclick="screentosphere(mouse.x, mouse.y, m_ath, m_atv); showlog(); trace('clicked at ath=',m_ath,' atv=',m_atv);" />
<action name="changepano">
for(set(i,0), i LT hotspot.count, inc(i),
if(hotspot[get(i)].style == 'thumb', set(hotspot[get(i)].enabled, false); );
if(hotspot[get(i)].name != 'vr_cursor', tween(hotspot[get(i)].alpha, 0.0, 0.25); );
);
delayedcall(0.25, %1; vr_menu_setvisibility(true); );
</action>
</krpano>
|