directional sound in Video Hotspots - HTML5

  • Hi
    I needed my video hotspots to have directional sound under VR so i used this


    Code
    <!-- put those lines under hotspot -->
     <events name="hotspot_name_3dsound" keep="false" onviewchange="viewaction(hotspot_name)"/>
     <action name="viewaction">
        getlooktodistance(hotspot_dist, hotspot[%1].ath, hotspot[%1].atv);
        set(new_volume, 0.8);   <!-- 0.8 - maximum volume -->
        div(hotspot_dist, 130);  <!-- 130 - range -->
        sub(new_volume, hotspot_dist);
        if(new_volume GT 0.1, set(hotspot[%1].volume, get(new_volume))); <!-- 0.1 - minimum volume-->
              <!--if sound can be muted use: set(hotspot[%1].volume, get(new_volume));-->
     </action>


    I don't know if this is most efficient way to do this, but i haven't found any other way to have directional sound for videos so that could be useful :)
    (probably works for sound on volume too ;)
    my example with that code:
    http://interaktywnapodroz.pl/promo/

    Filip.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!