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

Sunday, July 10th 2022, 8:17pm

stream multiple sounds in vtour and loop

I'm using maybe the simplest code to loop a music in the vtour across all scenes

Source code

1
<krpano version="1.20.11" title="Now Viewing" onstart="playsound(bgsnd,'audio/01.ogg',true,0.7);">

This works without a glitch.
What i need is to get a series of music to play one after the other and have this loop after the last music.
that would be like streaming some music without having to listen to a single one all the time.

2

Monday, July 11th 2022, 2:15am

You may just use

sound[name].oncomplete

to start the next one. And so on. Or write a little function to do so for all your sounds.

San7

Professional

Posts: 609

Occupation: coding in krpano

  • Send private message

3

Monday, July 11th 2022, 8:46am

Hello try this. list sound=" 1, 2, 3 ..." - list of paths to audio files.
The list will play in a circle

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<krpano version="1.20.11" title="Now Viewing" onstart="set(num_sound, 0); play_s()">
	
<!-- audio list -->
<list sound="audio/01.ogg, audio/20.ogg, audio/33.ogg"  /> 
	
<action name="play_s"  > 
	txtsplit(get(list.sound), ',', arr); 
	copy(var, arr[get(num_sound)].value); 
	playsound(bgsnd, get(var), false, 0.3, play_s() );		
	if(num_sound LT (arr.count - 1),
		inc(num_sound);
		,
		set(num_sound, 1);
	);
</action> 

4

Monday, July 11th 2022, 3:06pm

Yes it's exactly what I needed! You just opened the way to a streaming radio in the KRpano... Many thanks San!