HTML5-VR Audio Plugin
repository folder, DEMO
for HTML5 and WebVR! (Oculus Rift, Google Cardboard, GearVR, ...)
by Spacery Wirtualne - biuro@spacerywirtualne.pl
Most of the functions of this plugin is similar to the
Sound Interface Plugin krpano. We worked hard to get the functions that will be similar to Sound Interface Plugin krpano methods.
The Sound Interface plugin extends krpano with actions for playing and controlling sounds directly from xml.
Works fine with Panotour Pro
Plugin allows you to easily add sound objects
Works only in HTML5 and krpano version min. 1.19 pr4
Plugin supports mp3 and ogg files. Both files must have the same name and be in the same location
It works best in browsers that support the Web Audio API
Plugin works great in VR mode hardsets.
Easy to install
Copy the folder 'html5sound' to your project root
In the header index.html file add the following lines of code:<html>
<head>
[...]
<script src="html5sound/js/howler.core.min.js"></script>
<script src="html5sound/js/howler.effects.min.js"></script>
[...]
</head>
<body>
[...]
</body>
</html>
Put in your main xml file this line of code:
<include url="%FIRSTXML%/html5sound/xmls/init.xml"/>
<include url="%FIRSTXML%/html5sound/gui/xmls/init.xml" />
In Panotour Pro put in your main xml file this line of code:
<!-- ptp_datafolder_name = name of the folder repository, generated by Panotour Pro --/>
<krpano ptp_datafolder_name="tourdata" generated_by_panotour="true"/>
<include url="%FIRSTXML%/html5sound/xmls/init.xml"/>
<include url="%FIRSTXML%/html5sound/gui/xmls/init.xml" />
done
VIDEO
NOTE - this is a commercial plugin - to use it - it must be purchased.
You can purchase this plugin through the link below.
Updates for this plugin are free!
Works only in HTML5 and krpano version min 1.19 pr4!
Don't encrypt the init.xml file in the html5sound folder.
HTML5 Sound Interface Plugin will be developed dynamically, so the latest documentation is available online on the krpano forum.
The current documentation
The HTML5 Sound Interface plugin add its actions directly to the krpano root.
That means the actions can be called like normal krpano actions.
playHtml5sound(name, audiofile, loop*, volume*, oncomplete*);
preloads a sound file
name = identification name for the sound
audiofile = the path and filename of a sound file without extension
loop = true/false (default=false)
volume = sound volume (0.0 - 1.0, default=1.0)
oncomplete = actions that will be called on complete
playHtml5sound2D(keep, name, audiofile, rate*, volume*,loops*, onload*, onplay*,onpause*,onstop*,onmute*, oncomplete*);
preloads a sound file
keep = if true - remains on the next panorama (true/false, default=false)
name = identification name for the sound
audiofile = the path and filename of a sound file without extension
rate = playback speed (0.5 - 4.0, default =1.0)
volume = sound volume (0.0 - 1.0, default=1.0)
loops = true/false (default=false)
onload = actions that will be called on sound loaded
onplay = actions that will be called if the sound start to play
onpause = actions that will be called if the sound is paused
onstop = actions that will be called if the sound is stopped
onmute = actions that will be called if the sound is muted/unmuted
oncomplete = actions that will be called on complete
playHtml5sound3D(keep, name, audiofile, ath, atv, range, rate*, volume*, loops*, onload*, onplay*, onpause*, onstop*, onmute*, oncomplete*);
plays a sound file with adjustable volume and panning
keep = if true - remains on the next panorama (true/false, default=false)
name = identification name for the sound
audiofile = the path and filename of a sound file without extension
ath = horizontal sound source position (-180 .. 180)
atv = vertical sound source position (-90 .. +90)
range = range of the sound (in degrees, 10-360)
rate = playback speed (0.5 - 4.0, default =1.0)
volume = sound volume (0.0 - 1.0, default=1.0)
loops = true/false (default=false)
onload = actions that will be called on sound loaded
onplay = actions that will be called if the sound start to play
onpause = actions that will be called if the sound is paused
onstop = actions that will be called if the sound is stopped
onmute = actions that will be called if the sound is muted/unmuted
oncomplete = actions that will be called on complete
playHtml5sound3DHS(keep, name, audiofile, hotspotname, range, rate*, volume*, loops*, onload*, onplay*, onpause*, onstop*, onmute*, oncomplete*);
plays a directional 3D sound at a hotspot position - when the hotspot moves the sound will follow it
keep = if true - remains on the next panorama (true/false, default=false)
name = identification name for the sound
audiofile = the path and filename of a sound file without extension
hotspotname = name of the parent hotspot
range = range of the sound (in degrees, 10-360)
rate = playback speed (0.5 - 4.0, default =1.0)
volume = sound volume (0.0 - 1.0, default=1.0)
loops = true/false (default=false)
onload = actions that will be called on sound loaded
onplay = actions that will be called if the sound start to play
onpause = actions that will be called if the sound is paused
onstop = actions that will be called if the sound is stopped
onmute = actions that will be called if the sound is muted/unmuted
oncomplete = actions that will be called on complete
Html5Soundvolume(name, value);
volume settings
name = identification name of the sound
value = 0.0 - 1.0 (Number)
Html5Soundplay(name);
resumes a paused sound
name = identification name of the sound
Html5Soundpause(name,variable);
pauses a sound
name = identification name of the sound
variable (not required) = true - pause is ON, false - pause is OFF (Boolean) Html5Soundpause(name,false); - It works the same way as Html5Soundplay(name);
Html5Soundstop(name);
stops playing a sound
name = identification name of the sound
Html5Soundmute(name,variable);
stops playing a sound
name = identification name of the sound
variable = true - mute is ON, false - mute is OFF (Boolean)
Html5Soundrate(name, value);
playback speed settings
name = identification name of the sound
value = 0.5 - 4.0 (Number)
Html5SoundSetSeek(name, value);
Set the seek of the sound
name = identification name of the sound
value = in second (Number)
Html5SoundGetSeek(name, dstvar);
Get the seek value of the sound
name = identification name of the sound
dstvar = The destination variable name where the seek will be stored
Html5SoundGlobalmute(variable);
global action to MUTE or UNMUTE for the all sounds:
variable = true - mute is ON, false - mute is OFF (Boolean)