You are not logged in.

1

Wednesday, November 15th 2017, 10:43pm

How to set a background sound in all scenes of a vrtour

Hi

It's almost five days that I am trying to set a sound on my virtual tour, like a background sound in every scene which once I open the tour it starts to play, I have already tried the soundinterface plugin and checked almost all related threads on the forum. Do I need to change any code in vtourskin? Now don't know what to do! Here is my tour.xml and I 've saved two audio files with mp3 (2Mb) and wav (28Mb) formats in a subfolder named "sounds" in the vrtour, I'll be grateful if you would help me in it.


Tarannom
Bests
Tarannomkhak has attached the following file:
  • tour.xml (105.28 kB - 22 times downloaded - latest: Sep 16th 2019, 10:38pm)

2

Wednesday, February 21st 2018, 3:32pm

It was really an easy question and I don't know why I wasnt able to handle it *unsure* Maybe someone like me needs help in it, so the code I used is below:


At first add the action "playsound(bgsnd, '1.mp3|1.ogg', 0);" to onstart event in main element of a Krpano .xml file.



<krpano version="1.19" title="Virtual Tour" onstart="playsound(bgsnd, '1.mp3|1.ogg', 0);"
>


And then put the code below



<plugin name="soundinterface"
url.flash="%SWFPATH%/plugins/soundinterface.swf"
url.html5="%SWFPATH%/plugins/soundinterface.js"
rootpath=""
preload="true"
keep="true"
/>




after the code:


<action name="startup" autorun="onstart">
loadscene(scene_name, null, MERGE);
</action>


I hope it helps *smile*


Bests
Fatemeh

Tuur

Sage

Posts: 3,172

Location: Netherlands

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

  • Send private message

3

Wednesday, February 21st 2018, 7:02pm

Hi,

Best woold be to put the playsound code line in the startup action.
So, keep it all outside the scenes.
It could be that a screentouch is needed to start audio.
I’ll post a simple example tomorrow when i don’t forget.

simpel code example:

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
<krpano logkey="true">


	<!-- startup action - load the first scene -->
	<action name="startup" autorun="onstart">
		if(startscene === null OR !scene[get(startscene)], copy(startscene,scene[0].name); );
		loadscene(get(startscene), null, MERGE);
		if(startactions !== null, startactions() );
		playsound(test, audio/test.mp3, 0);
	</action>

	<style name="htsp" type="text" ath="0" atv="0" width="40" height="40" bgroundedge="20" bgcolor="0xffff00" bgalpha="1" html="Click Me" css="font-family:Helvetica;font-size:14px;color:0x333333;text-align:center;" vcenter="true" />
	
	<scene name="scene_1" title="a1" onstart=""  >
		<preview type="grid(cube,64,64,512,0x666666,0x222222,0x222222);" details="16"/>
		<view hlookat="0" />
		<hotspot name="spot1" style="htsp" onclick="loadscene(scene_2)" />
	</scene>

	<scene name="scene_2" title="a2" onstart=""  >
		<preview type="grid(cube,64,64,512,0x666666,0x999999,0x222222);" details="16"/>
		<view hlookat="20" />
		<hotspot name="spot1" style="htsp" onclick="loadscene(scene_3)" />
		
	</scene>

	<scene name="scene_3" title="a3" onstart=""  >
		<preview type="grid(cube,64,64,512,0xffffff,0x336699,0x222222);" details="16"/>
		<view hlookat="-20" />
		<hotspot name="spot1" style="htsp" onclick="loadscene(scene_1)" />
		
	</scene>
	

	
	
	<plugin name="soundinterface"
		keep="true"		
        url="plugins/soundinterface.js"
        preload="true"
        rootpath=""
        volume="1.0"
        mute="false"
        />
</krpano>


Hope it helps!

Tuur *thumbsup*
http://www.virtualtuur.com
Skype:studiotuur

This post has been edited 1 times, last edit by "Tuur" (Feb 22nd 2018, 11:32am)