After adding a sound with playHtml5sound3D(false, Anmoderation, html5sound/assets/Anmoderation, -1, -2, 120, 1.0, 1.0, false),
it seems that the sound is loaded twice.
Html5Soundpause(Anmoderation) only seems to pause one sound and the other one is still playing.
<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>
Display More
i am useing the videointerface given on Klaus's web-VR-example.