Sie sind nicht angemeldet.

1

Donnerstag, 4. August 2016, 10:45

how to change background sound in every scene

hi,i use this code to play different background sound in each scene,
<krpano onstart="playsound(bg, backgroundmusic.mp3); loadscene(scene1,null,MERGE);">
<plugin name="soundinterface" url="soundinterface.swf" alturl="soundinterface.js" preload="true" />
<scene name="scene1">
<events name="scene1events" onxmlcomplete="playsound(scene1sound, scene1music.mp3);" onremovepano="stopsound(scene1sound);" />
</scene>
<scene name="scene2">
<events name="scene2events" onxmlcomplete="playsound(scene2sound, scene2music.mp3);" onremovepano="stopsound(scene2sound);" />
</scene>
</krpano>
but i need to build 3 button in 3 languages as background sound. when i click 1 button the language in all scene will turn to 1 language.
my idea is put 3 language in 3 folder, when 1 kind language onclick, all background sound url change.
is it posibble, how to do?

Tuur

Erleuchteter

Beiträge: 3 839

Wohnort: Netherlands

Beruf: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer

  • Nachricht senden

2

Donnerstag, 4. August 2016, 13:03

hi,

this is fairly simple to do.

so the button Dutch is clicked. Then set for example set(_lang, Dutch);

Quellcode

1
<scene name="scene_1" title="scene1" audio="thekrpanosongpart1.mp3" onstart=""  >


and

Quellcode

1
<events name="audio" keep="true" onnewscene="PlayAudio" />


and

Quellcode

1
2
3
4
5
6
7
8
<action name="PlayAudio">
	set(_audio, calc:'audioplayer/audio/' + _lang + '/' + scene[get(xml.scene)].audio);
	if(scene[get(xml.scene)].audio,
		playsound(sound1,get(_audio));
	,
		stopsound(sound1);
	);	
</action>


something like that.


EDIT: sorry.. i forgot the language.. haha .. edited in..

Hope it helps!
Tuur *thumbsup*

Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »Tuur« (4. August 2016, 13:25)


3

Montag, 14. November 2016, 02:44

can it work for hotspot

thanks a lot sage,it works fine.
i also have two language hotspot in the scene.
i want to make one onloaded action to check what' language was select for the hotspot.
how can i do?

4

Freitag, 25. November 2016, 11:04

hi,

this is fairly simple to do.

so the button Dutch is clicked. Then set for example set(_lang, Dutch);

Quellcode

1
<scene name="scene_1" title="scene1" audio="thekrpanosongpart1.mp3" onstart=""  >


and

Quellcode

1
<events name="audio" keep="true" onnewscene="PlayAudio" />


and

Quellcode

1
2
3
4
5
6
7
8
<action name="PlayAudio">
	set(_audio, calc:'audioplayer/audio/' + _lang + '/' + scene[get(xml.scene)].audio);
	if(scene[get(xml.scene)].audio,
		playsound(sound1,get(_audio));
	,
		stopsound(sound1);
	);	
</action>


something like that.


EDIT: sorry.. i forgot the language.. haha .. edited in..

Hope it helps!
Tuur *thumbsup*


hi Tuur, another problem i haven't found before.
i also use set(_lang,chinese) in the first scene onstart, if i don't the first scene will link none mp3.
when i go back to the first scene, the language will return to chinese.
i also use action set(_lang,chinese) in startup but it doesn't work.
how to set one kind language as default.

Tuur

Erleuchteter

Beiträge: 3 839

Wohnort: Netherlands

Beruf: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer

  • Nachricht senden

5

Freitag, 25. November 2016, 12:08

Call it before it loads the scene.

Tuur *thumbsup*