You are not logged in.

Dear visitor, welcome to krpano.com Forum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Saturday, May 23rd 2009, 11:34pm

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.

Source code

1
2
3
4
5
<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.

Source code

1
2
3
4
5
<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

.

Graydon

Professional

Posts: 614

Location: Texas

Occupation: Industrial gas turbine services.

  • Send private message

2

Sunday, May 24th 2009, 4:38am

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.

3

Sunday, May 24th 2009, 6:20am

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.

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
		<plugin name="combobox"
        	url="plugins/combobox.swf" 
        	align="lefttop" 
        	x="10" 
        	y="10" 
        	width="150"
        	keep="true"
        	/>
	
	<action name="combobox:bell  Exterior">
    	loadpano(exterior_day.xml,null,MERGE,BLEND(1));
	</action>
	
		<action name="combobox:bell Interior Day">
    	loadpano(interior_day.xml,null,MERGE,BLEND(1));
	</action>

	<action name="combobox:bell  Interior Dusk">
    	loadpano(interior_night.xml,null,MERGE,BLEND(1));
	</action>



Andrew

Graydon

Professional

Posts: 614

Location: Texas

Occupation: Industrial gas turbine services.

  • Send private message

4

Monday, May 25th 2009, 7:48am

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.

5

Monday, May 25th 2009, 7:58pm

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*

Source code

1
2
3
4
5
<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

martyhr

Intermediate

Posts: 209

Location: CZ

  • Send private message

6

Tuesday, May 26th 2009, 11:07pm

Andrew, give a link and we can check it ;-)
Marty

7

Wednesday, May 27th 2009, 2:18am

Completed

Hi Marty,

It's fixed.

I added the code in the post above after reading Graydon's posts and some more hunting around. It's for a client so only currently on their server. Will add a link once it's completed and live ;-)

Andrew