background sound

  • Hello Everyone,


    I never tried adding sound to the virtual tours, so it is my first time. And I need your help.
    My virtual tours are generated automatically by the make vtour tool.


    I tried adding this code

    Code
    <!-- load the soundinterface plugin --> 	<plugin name="soundinterface"	    	url="http://at-bangkok.com/virtualtours/snc/plugins/soundinterface.swf"	    	alturl="http://at-bangkok.com/virtualtours/snc/plugins/soundinterface.js"	    	rootpath=""	    	preload="true"	    	keep="true"	    	/>
    	<!-- start playing the sound -->	<events name="currentpano"	        onnewpano="playsound(bgsnd, 'http://at-bangkok.com/virtualtours/snc/1.MP3|http://at-bangkok.com/virtualtours/snc/1.wav', 0);"	        onremovepano="stopsound(bgsnd);"	        />
    
    
    	<!-- button to pause the sound: -->	<plugin name="snd" url="http://at-bangkok.com/virtualtours/snc/soundonoff.png" align="topleft" x="10" y="10" alpha="0.25" scale="0.5" onover="tween(alpha,1);" onout="tween(alpha,0.25);"	        crop="0|0|50|50"	        onloaded="if(ismobile,set(scale,1));"	        onclick="pausesoundtoggle(bgsnd); switch(crop, 0|0|50|50, 0|50|50|50);"	        />


    to the both tour.xml and vtourskin.xml but it don't work. The soundonoff.png doesn't even show.

    Please let me know what I did wrong. the vtour link is http://at-bangkok.com/virtualtours/snc/

    Any input would be appreciated. Thank you!

    Best regards
    VAsin

  • The audio dose work on Android 4.2 and IPAD, but the sound on off button doesn't display.

    BUT it does not work on the PC.

    I can't figure out why the "sound on off" does not appear?

    Code
    <plugin name="soundinterface"	        url="plugins/soundinterface.swf"	        alturl="plugins/soundinterface.js"	        rootpath=""	        preload="true"	        keep="true"	        />
    	<!-- start playing the sound -->	<events name="currentpano"	        onnewpano="playsound(bgsnd, '1.mp3|1.wav', 0);"	        onremovepano="stopsound(bgsnd);"	        />
    
    
    	<!-- button to pause the sound: -->	<plugin name="snd" url="soundonoff.png" align="lefttop" x="10" y="10" alpha="0.25" scale="0.5" onover="tween(alpha,1);" onout="tween(alpha,0.25);"	        crop="0|0|50|50"	        onloaded="if(ismobile,set(scale,1));"	        onclick="pausesoundtoggle(bgsnd); switch(crop, 0|0|50|50, 0|50|50|50);"	        />


    Please any input? the tour.xml file is attached

  • Hi,

    the "currentpano" <events> and "snd" <plugin> elements need a keep="true" to be able to used within the scenes.

    Without keep="true" they will be get instantly removed at startup when the first scene will be loaded.

    Best regards,
    Klaus

  • Klaus,

    Thank you so much.

    It worked but every time I change a scene, the audio starts over.

    Is it possible to have it play continuously and loop when it ends?

    Code
    <plugin name="soundinterface"	        url="plugins/soundinterface.swf"	        alturl="plugins/soundinterface.js"	        rootpath=""	        preload="true"	        keep="true"	        />
    	<events name="currentpano"	        onnewpano="playsound(bgsnd, '1.mp3|1.wav', 0);"	        onremovepano="stopsound(bgsnd);"			keep="true"	        />
    	<plugin name="snd" url="soundonoff.png" align="lefttop" x="10" y="10" alpha="0.25" scale="0.5" onover="tween(alpha,1);" onout="tween(alpha,0.25);"	        crop="0|0|50|50"	        onloaded="if(ismobile,set(scale,1));"	        onclick="pausesoundtoggle(bgsnd); switch(crop, 0|0|50|50, 0|50|50|50);"			keep="true"	        />


    Thank you again

  • Hi,

    the event will be called with every new pano,
    to play it only once with remove the event after the first call or use the krpano onstart event to play the sound,

    e.g.
    <events name="currentpano" keep="true" onnewpano="playsound(bgsnd, '1.mp3|1.wav', 0); set(events[currentpano].onnewpano,null);" />

    or simply:
    <krpano onstart="...; playsound(...);">
    ...

    Best regards,
    Klaus

Participate now!

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