Preload Audio

When timing is critical, you may want to pre-load your audio.


To pre-load an audio track in order to achieve a faster effect when calling the sayAudio() command do the following:
  1. Call the loadAudio() command: loadAudio('audioLoaded')

  2. Use the Javascript event function vh_audioLoaded(args) in the HEAD section to check if the audio track is loaded: "function vh_audioLoaded(args){"
    In this example you will see a JavaScript alert displayed when the audio is ready.

  3. When the audio is loaded, play it using the sayAudio() command: "sayAudio(args);"


    Note: In this example we check to see if the audio was loaded and only then play it. The audio will play even if the pre-load was not done yet.

© 2003 Oddcast Inc. All Right Reserved