q5play
    Preparing search index...

    Function loadAudio

    • 🔊 Loads audio data from a file and returns an HTMLAudioElement.

      Audio is considered loaded when the canplaythrough event is fired.

      Note that audio can only be played after the first user interaction with the page!

      Parameters

      • url: string

      Returns HTMLAudioElement & PromiseLike<HTMLAudioElement>

      await Canvas(200);

      let audio = loadAudio('/assets/retro.flac');
      audio.volume = 0.4;

      q5.mousePressed = function () {
      audio.play();
      };