Sie sind nicht angemeldet.

1

Mittwoch, 26. Januar 2022, 20:13

Button On/Off

Hello,
I am beginner: I have get to play a background sound in my vtour, but I cannot get to show and use a button on/off fo sound like it is in the examples of krpano.
The code I am trying is:

Quellcode

1
2
3
4
5
<!-- a button to pause/play the sound -->
	<layer name="snd" url="soundonoff.png" align="leftbottom" x="10" y="10" alpha="0.25" scale="0.5" onover="tween(alpha,1);" onout="tween(alpha,0.25);"
	       crop="0|0|50|50"
	       onclick="pausesoundtoggle(bgsnd); switch(crop, 0|0|50|50, 0|50|50|50);"
	       />

adn this is the xml I have write:

Quellcode

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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<krpano version="1.20.11" title="Virtual Tour">

    <include url="skin/vtourskin.xml" />

    <!-- customize skin settings: maps, gyro, webvr, thumbnails, tooltips, layout, design, ... -->
    <skin_settings maps="false"
               	maps_type="google"
               	maps_bing_api_key=""
               	maps_google_api_key=""
               	maps_zoombuttons="false"
               	maps_loadonfirstuse="true"
               	gyro="true"
               	gyro_keeplookingdirection="false"
               	webvr="true"
               	webvr_keeplookingdirection="true"
               	webvr_prev_next_hotspots="true"
               	autotour="false"
               	littleplanetintro="false"
               	followmousecontrol="false"
               	title="true"
               	thumbs="true"
               	thumbs_width="120" thumbs_height="80" thumbs_padding="10" thumbs_crop="0|40|240|160"
               	thumbs_opened="false"
               	thumbs_text="false"
               	thumbs_dragging="true"
               	thumbs_onhoverscrolling="false"
               	thumbs_scrollbuttons="false"
               	thumbs_scrollindicator="false"
               	thumbs_loop="false"
               	tooltips_buttons="false"
               	tooltips_thumbs="false"
               	tooltips_hotspots="false"
               	tooltips_mapspots="false"
               	deeplinking="false"
               	loadscene_flags="MERGE"
               	loadscene_blend="OPENBLEND(0.5, 0.0, 0.75, 0.05, linear)"
               	loadscene_blend_prev="SLIDEBLEND(0.5, 180, 0.75, linear)"
               	loadscene_blend_next="SLIDEBLEND(0.5,   0, 0.75, linear)"
               	loadingtext=""
               	layout_width="100%"
               	layout_maxwidth="814"
               	controlbar_width="-24"
               	controlbar_height="40"
               	controlbar_offset="20"
               	controlbar_offset_closed="-40"
               	controlbar_overlap.no-fractionalscaling="10"
               	controlbar_overlap.fractionalscaling="0"
               	design_skin_images="vtourskin.png"
               	design_bgcolor="0x2D3E50"
               	design_bgalpha="0.8"
               	design_bgborder="0"
               	design_bgroundedge="1"
               	design_bgshadow="0 4 10 0x000000 0.3"
               	design_thumbborder_bgborder="3 0xFFFFFF 1.0"
               	design_thumbborder_padding="2"
               	design_thumbborder_bgroundedge="0"
               	design_text_css="color:#FFFFFF; font-family:Arial;"
               	design_text_shadow="1"
               	/>

    <!--
    	For an alternative skin design either change the <skin_settings> values 
    	from above or optionally include one of the predefined designs from below.
    -->
    <!-- <include url="skin/vtourskin_design_flat_light.xml"  /> -->
    <!-- <include url="skin/vtourskin_design_glass.xml"   	/> -->
    <!-- <include url="skin/vtourskin_design_ultra_light.xml" /> -->
    <!-- <include url="skin/vtourskin_design_117.xml"     	/> -->
    <!-- <include url="skin/vtourskin_design_117round.xml"	/> -->
    <!-- <include url="skin/vtourskin_design_black.xml"   	/> -->

<plugin name="soundinterface"
    	url.html5="plugins/soundinterface.js"
    	url.flash="plugins/soundinterface.swf"
    	preload="true"
    	rootpath=""
    	volume="1.0"
    	mute="false"
    	panningmodel="simple"
    	worldscale="1.0"
    	autopause="true"
    	autounlock="true"
    	/>
<action name="PrepareSounds" autorun="onstart">
    	preloadsound(sound/blur.mp3); 
    playsound('auto',sound/blur.mp3);
	</action>
    
    <scene name="scene_AFF_FECIT_0525" title="AFF FECIT 0525" onstart="" thumburl="panos/AFF_FECIT_0525.tiles/thumb.jpg" lat="" lng="" heading="">
    	
    	<control bouncinglimits="calc:image.cube ? true : false" />

    	<view hlookat="0.0" vlookat="0.0" fovtype="MFOV" fov="120" maxpixelzoom="2.0" fovmin="70" fovmax="140" limitview="auto" />

    	<preview url="panos/AFF_FECIT_0525.tiles/preview.jpg" />

    	<image hfov="1.00" vfov="0.669421" voffset="0.00">
    		<flat url="panos/AFF_FECIT_0525.tiles/l%l/%v/l%l_%v_%h.jpg" multires="512,1024x686,2048x1372,3840x2572" />
    	</image>

    </scene>

    <scene name="scene_LIG_FECTI0383" title="LIG FECTI0383" onstart="" thumburl="panos/LIG_FECTI0383.tiles/thumb.jpg" lat="" lng="" heading="">
    	
    	<control bouncinglimits="calc:image.cube ? true : false" />

    	<view hlookat="0.0" vlookat="0.0" fovtype="MFOV" fov="120" maxpixelzoom="2.0" fovmin="70" fovmax="140" limitview="auto" />

    	<preview url="panos/LIG_FECTI0383.tiles/preview.jpg" />

    	<image hfov="1.00" vfov="0.750000" voffset="0.00">
    		<flat url="panos/LIG_FECTI0383.tiles/l%l/%v/l%l_%v_%h.jpg" multires="512,768x576,1664x1248,3328x2496" />
    	</image>

    </scene>

    <scene name="scene_LIG_FECTI0385" title="LIG FECTI0385" onstart="" thumburl="panos/LIG_FECTI0385.tiles/thumb.jpg" lat="" lng="" heading="">
    	
    	<control bouncinglimits="calc:image.cube ? true : false" />

    	<view hlookat="0.0" vlookat="0.0" fovtype="MFOV" fov="120" maxpixelzoom="2.0" fovmin="70" fovmax="140" limitview="auto" />

    	<preview url="panos/LIG_FECTI0385.tiles/preview.jpg" />

    	<image hfov="1.00" vfov="0.750000" voffset="0.00">
    		<flat url="panos/LIG_FECTI0385.tiles/l%l/%v/l%l_%v_%h.jpg" multires="512,768x576,1664x1248,3328x2496" />
    	</image>

    </scene>


</krpano>

Has anybody any idea of where is the problem?
Thnak a lot.

Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »aferferro« (27. Januar 2022, 08:08)


2

Sonntag, 30. Januar 2022, 14:53

Hi,

add keep="true" to the layer of the button to avoid that it get removed:

Quellcode

1
<layer name="snd" ... keep="true" ...


And in the playsound call use 'bgsnd' instead of 'auto':

Quellcode

1
playsound('auto',sound/blur.mp3);


Otherwise the

Quellcode

1
pausesoundtoggle(bgsnd)
call will not work.

Best regards,
Klaus