melonJS
    Preparing search index...

    Function init

    • Initialize and configure the audio module.

      For maximum browser coverage, list at least two formats — typically webm first then mp3. Webm has near-universal modern coverage with great compression / quality balance; mp3 covers older browsers. Order matters: melonJS picks the first compatible format from the list, so put the preferred one first.

      Parameters

      • format: string = "mp3"

        Comma-separated audio formats to prioritize. One or more of: "mp3", "mpeg", "opus", "ogg", "oga", "wav", "aac", "caf", "m4a", "m4b", "mp4", "weba", "webm", "dolby", "flac". Defaults to "mp3".

      Returns boolean

      true when audio support was successfully initialised.

      // initialise with webm preferred, mp3 as fallback
      if (!me.audio.init("webm,mp3")) {
      alert("Sorry but your browser does not support html 5 audio !");
      return;
      }