Sie sind nicht angemeldet.

Lieber Besucher, herzlich willkommen bei: krpano.com Forum. Falls dies Ihr erster Besuch auf dieser Seite ist, lesen Sie sich bitte die Hilfe durch. Dort wird Ihnen die Bedienung dieser Seite näher erläutert. Darüber hinaus sollten Sie sich registrieren, um alle Funktionen dieser Seite nutzen zu können. Benutzen Sie das Registrierungsformular, um sich zu registrieren oder informieren Sie sich ausführlich über den Registrierungsvorgang. Falls Sie sich bereits zu einem früheren Zeitpunkt registriert haben, können Sie sich hier anmelden.

1

Samstag, 31. Juli 2021, 16:58

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:

https://1871.Chicago00.org (the audio tours are under 'STORIES' in the left menu)

Any suggestions?

Much thanks.

--------------------------------------UPDATE

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);
playsound(mySound);

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

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

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

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

Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »garhodes« (9. August 2021, 05:21)