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

Monday, February 23rd 2009, 7:06am

How can I add a mute button ?

I like the sound element very much. But I think some users may be in an office and need to mute. How can I add a mute button ?

3

Monday, February 23rd 2009, 12:58pm

Thanks Job1. I finally figured this plugin was from the beta. But I can't get anything to happen. Do I need to code my own litle buttons as swfs ? The documentation on this stuff is a bit sparse.

( I also just took the soundinterafce.swf by itself from the beta and dropped it into my existing plugins folder. I suppose that is OK ? )

4

Monday, February 23rd 2009, 1:12pm

You have to get the 1.08b5 files complete ;-) plugins, swfobject and krpano .swf

5

Monday, February 23rd 2009, 1:53pm

OK, done that, but still no luck.

I must say that the haphazard blobs of XML scattered about various areas of this site, combined with the awful command line "interface" of the tool set, makes KR Pano one of the most horribly tedious time-vampire apps I've used in a long time.

But I am most grateful for your help Job1 ! *smile*

6

Monday, February 23rd 2009, 2:08pm

What is your code ? perhaps a syntaxe problem

7

Monday, February 23rd 2009, 2:49pm

You are very kind to keep going with me !

Source code

1
2
3
4
5
6
7
8
9
10
11
	<plugin name="soundinterface" url="plugins/soundinterface.swf">
		<onloaded="garden.mp3" />
	</plugin>

	<plugin name="playbutton" url="btn_star.jpg"
	onclick="playsound(garden.mp3);"
	/>

	<plugin name="stopbutton" url="btn_stop.jpg"
	onclick="stopsound(garden.mp3);"
	/>


I have tried various permutations of the buttons. I can get one to appear top-left, and the "hand" appears on rollover, but never any sound.

The old sound.swf works fine. *sad*

8

Monday, February 23rd 2009, 3:01pm

okay you forgot "mymusik"

Try with this code

Source code

1
2
3
4
5
6
7
<plugin name="playbutton" url="btn_star.jpg"
	onclick="playsound(mymusik,garden.mp3);"
	/>

	<plugin name="stopbutton" url="btn_stop.jpg"
	onclick="stopsound(mymusik);"
	/>

;-)

Graydon

Professional

Posts: 614

Location: Texas

Occupation: Industrial gas turbine services.

  • Send private message

9

Tuesday, February 24th 2009, 7:08pm

Here's the documentation from the original posting. I agree... things get scattered about when using the beta version since all documentation is in the forum... but there's no other real place to put it I guess, until the "stable" version is released and the main site is updated.

-----------------------

A new Sound Plugin - soundinterface.swf
  • this plugin adds functions to play and controls sounds direct from the xml.
  • only this one plugin must be loaded for all sound.

Attributes:
  • onloaded
    • this action is called when the plugin was loaded and is ready for use.
    • can be used for preloading sound.
  • rootpath
    • root path of the sound files.
    • relative from the xml file, default="".
Functions:
  • preloadsound(mp3file);
    • preloads a sound file
    • this can be used to reduce the latency when starting play
    • mp3file = the filename/path of a sound file
  • playsound(id,mp3file,loops);
    • plays a sound file
    • id = id/name of the sound (use "auto" for a automatic new id for every play)
    • loops = optional, number of loops, 0=endless, default=1
  • stopsound(id);- stops playing a sound
    • id = id/name of the sound
  • stopallsounds();
    • stop all current playing sounds
XML usage example:


Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<plugin name=soundinterface" 
        url="plugins/soundinterface.swf" 
        rootpath="sounds/" 
        />

<hotspot name="s1" url="spot.png"
         onclick="playsound(auto,tada.mp3);"
         onover="playsound(auto,over.mp3);"
         onout="playsound(auto,out.mp3);"
         />
<hotspot name="s2" url="spot.png"
         onclick="stopallsounds();
                  loadpano(next.xml,null,MERGE,BLEND(1));
                  playsound(auto,newsound.mp3);"
         />
   


----------------

Looks like Job.1 identified it correctly... you are not specifying an ID (i.e. mymusik) for the sound in playsound.

10

Wednesday, February 25th 2009, 6:22am

Thanks for all the help here *smile*

I do like KRPano, and it is very powerful. I'm finding you just need to be patient.

Anyway, for reference purposes, here's the code which finally worked. MP3 is called "chica.mp3", and there's two buttons positioned along the bottom called "play-sound.png" and "stop-sound.png". Everything else is standard.

Edit: One thing still puzzles me. Why is the soundinterface plugin 500 x 375px ? Is it meant to include its own buttons ?

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<plugin name="soundinterface"
 	    	url="plugins/soundinterface.swf"
	    	keep="true"
 	    	visible="true" enabled="true" handcursor="true" capture="true" children="true"
 	    	zorder="0"
 	    	alpha="1.00" blendmode="normal"
 	    	smoothing="true"
 	    	origin="" edge=""
 	    	x="" y=""
 	    	width="500" height="375"
	    	scale="1"
	    	onloaded=""
	    	onover=""
	    	onhover=""
	    	onout=""
	    	ondown=""
	    	onup=""
	    	onclick=""
	    	rootpath=""
	    	/>



	<plugin name="stopbutton"
 	    	url="stop-sound.png"
	    	keep="false"
 	    	visible="true" enabled="true" handcursor="true" capture="true" children="true"
 	    	zorder="0"
 	    	alpha="1.00" blendmode="screen"
 	    	smoothing="true"
 	    	origin="bottom" edge="center"
 	    	x="+210" y="40"
 	    	width="" height=""
	    	scale="1"
	    	onloaded=""
	    	onover="set(blendmode,add);"
	    	onhover="showtext(Stop sound);"
	    	onout="set(blendmode,screen);"
	    	ondown=""
	    	onup=""
	    	onclick="stopsound(mymusik);"
	    	/>



	<plugin name="playbutton"
 	    	url="play-sound.png"
	    	keep="false"
 	    	visible="true" enabled="true" handcursor="true" capture="true" children="true"
 	    	zorder="0"
 	    	alpha="1.00" blendmode="screen"
 	    	smoothing="true"
 	    	origin="bottom" edge="center"
 	    	x="+160" y="40"
 	    	width="" height=""
	    	scale="1"
	    	onloaded=""
	    	onover="set(blendmode,add);"
	    	onhover="showtext(Play sound);"
	    	onout="set(blendmode,screen);"
	    	ondown=""
	    	onup=""
	    	onclick="playsound(mymusik,chica.mp3);"
	    	/>

11

Wednesday, February 25th 2009, 9:49am

If you want switch the sound button to mute button, and you have only once button for the music

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<plugin name="bt2" 
	url="nav/sound.png"
	alpha="0.85" 	   
	zorder="2"   
	origin="bottom" 
	edge="center" 
	y="30" x="-105"
	visible="false"
	onhover="showtext(Musique On);"                     
	onclick="action(sound)" />		   	
			   
   <plugin name="bt3" 
	url="nav/mute.png"
	alpha="0.85" 	   
	zorder="2"   
	origin="bottom" 
	edge="center" 
	y="30" x="-105"
	visible="true"
	onhover="showtext(Musique Off);"                    
	onclick="action(mute)" />

       <action name="sound">
		playsound(mymusik,chant.mp3,loops);
		set(plugin[bt3].visible,true);
		set(plugin[bt2].visible,false);
	</action>
	<action name="mute">
		stopsound(mymusik);
		set(plugin[bt3].visible,false);
		set(plugin[bt2].visible,true);
	</action>

12

Wednesday, February 25th 2009, 11:10am

Edit: One thing still puzzles me. Why is the soundinterface plugin 500 x 375px ? Is it meant to include its own buttons ?
Hi,

this size is determined from the editor plugin,
every swf has a "default"-size defined, even if there are no visible elements, but the editor plugin doesn't know that,
so the values can be just ignored (or better - removed - to avoid confusing )
but anyway - I will try to fix this in the final editor version.

best regards,
Klaus

Similar threads