You are not logged in.

Dear visitor, welcome to 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.


Saturday, July 31st 2021, 4:58pm

Wait for sound to load or preload before continuing action - SOLVED?

I have several audio-narrated tours of my pano. When the user selects one, I would like to first load the audio file, and then begin the series of LookTo() actions, so that the movements and audio are synced.

I am looking for a command to wait for the audio to load before continuing (similar to the wait(load); for the panorama). Ideally I would display a message that says "audio loading..." while this loop is running.

I've tried a few set of solutions without success. seeksound() seems to be unreliable for some reason. preloadsound() doesn't wait for load before continuing.

Right now, I simply preload all of the sounds when the website first loads, which works, but it's a heavy delay of several mb right at the beginning: (the audio tours are under 'STORIES' in the left menu)

Any suggestions?

Much thanks.


I have an answer to my own question. Though I'm not sure it's a very efficient way to do it.

This seems to work:

createsound(mySound, audioFile);

set(layer[soundLoadingText_text].visible, true);

txtadd(layer[soundLoadingText_text].html, 'Loading sound', '...');

set(soundDuration, get(sound[mySound].duration));
asyncloop(soundDuration LE 0,
set(soundDuration, get(sound[mySound].duration));,

set(layer[soundLoadingText_text].visible, false);

This post has been edited 1 times, last edit by "garhodes" (Aug 9th 2021, 5:21am)