Load a different MP3 for multiple panoramas

  • Hi,

    I have 3 panoramas and each one has it's own xml file. They are viewable using the combobox and when the first one loads, it's the exterior of a helicopter and I have the sound exterior_running.mp3 playing on a loop. Also the sound on/off buttons are allocated the mp3.

    Code
    <plugin name="soundinterface" url="plugins/soundinterface.swf" rootpath="audio" onloaded="preloadsound(exterior_running.mp3);playsound(mymusik,exterior_running.mp3,loops);" />
    
    
    <plugin name="soundon" url="skin/sound.png" zorder="10" align="bottomright" edge="bottomright" x="185" y="4" onhover="showtext(AUDIO ON,buttonstyle);" onclick="playsound(mymusik,exterior_running.mp3,loops);" />
    
    
    <plugin name="soundoff" url="skin/soundoff.png" zorder="10" align="bottomright" edge="bottomright" x="150" y="4" onhover="showtext(AUDIO OFF,buttonstyle);" ondown="stopsound(mymusik);" onclick="stopsound(mymusik);" />


    Then when either of the others panoramas are chosen (both interior shots) from the combobox I have the following code in their xml files and the sound file interior_running.mp3 should be running.

    Code
    <plugin name="soundinterface" url="plugins/soundinterface.swf" rootpath="audio" onloaded="preloadsound(interior_running.mp3);playsound(mymusik,interior_running.mp3,loops);" />
    
    
    <plugin name="soundon" url="skin/sound.png" zorder="10" align="bottomright" edge="bottomright" x="185" y="4" onhover="showtext(AUDIO ON,buttonstyle);" onclick="playsound(mymusik,interior_running.mp3,loops);" />
    
    
    <plugin name="soundoff" url="skin/soundoff.png" zorder="10" align="bottomright" edge="bottomright" x="150" y="4" onhover="showtext(AUDIO OFF,buttonstyle);" ondown="stopsound(mymusik);" onclick="stopsound(mymusik);" />

    but the problem is even though the new pano has loaded, the sound hasn't changed unless I actually click on the sound on/off buttons to load the new mp3.

    What I'd like to do is stop the current sound playing and then start the new one in the next panorama. Is that possible?

    Look forward to any advice please.

    Thanks,

    Andrew

    .

  • First... depends upon how you "flagged" your loadpano action from the combobox...

    ref: http://www.krpano.com/docu/actions/#loadpano

    If you used "merge"... then new plugins...i.e. new sounds... are not loaded... when they have the same name.

    But, since once you are in the new pano and stopping / starting the sound plays the correct one...

    ... You can update the action that loads the new pano to first stop the sound from the first pano... and then start playing the sound from the new pano after the preview is loaded.

    Post the code you use from the combobox to load a new pano and we can probably fill in specifics.

  • Thanks for the reply Graydon.

    Here's the code for the combobox. It's the same on each of the three xml files. As you mentioned, the MERGE is there. The only thing really that is different on each of the files is a large amount of hotspots and the sound.


    Andrew

  • Since your soundinterface plugin doesn't have keep=true... it looks like it should work as you have it coded.

    How are you starting the sound in the first xml (exterior)... and what is in the other xml's to initiate the sound? An onloaded or similar?

    I haven't used the soundinterface alot... so I can't say for sure where else a problem would be.

    You may just have to change the combobox actions to first stop the existing sound, load the pano and then initiate a new sound.

    The sample for the s2 hotspot here would be a basic template.

  • Hi Graydon,

    Thanks for the extra info. I never thought to add extra code to the combobox. I did a bit more hunting and reading and added stopallsounds(); and playsound(mymusik,exterior_running.mp3,loops); to the combobox area. Then it was just the case of changing the other entries for the other panoramas loaded with the combobox. I now have 5 panoramas and they all load their own allocated sound *g*

    Code
    <action name="combobox:Bell Exterior">
        	stopallsounds();
        	loadpano(exterior_day.xml,null,MERGE,BLEND(1));
       	 playsound(mymusik,exterior_running.mp3,loops);
    	</action>

    All the best,

    Andrew

Participate now!

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