Audio compatibility problem with firefox API

Asked

Viewed 73 times

5

I’m using the API to emit some sounds, the problem is that in Firefox I can’t get around mp3, but how can I include other formatting in that code?

How can I add another font ogg for example?

I’m using API to call Audio like this:

 var SomDeDigito = new Audio('sounds/keyboard.mp3');
 var SomDeError = new Audio('sounds/erro.mp3');
 var SomDeSky = new Audio('sounds/sky.mp3');
 var SomDeEstrela = new Audio('sounds/estrela.mp3');
 var SomDeSkyFall = new Audio('sounds/skyFall.mp3');

function digito(){
    SomDeDigito.pause();
    SomDeDigito.currentTime = 0;
    SomDeDigito.play();
}

2 answers

4


Audio API support in Firefox is at the moment partial, as you can see in this list of the Mozilla Foundation:

<audio>: MP3    Firefox (Gecko): Partial (see below)

To avoid Patent issues, support for MPEG 4, H.264, MP3 and AAC is not built directly into Firefox on desktop and mobile (Android and Firefox OS). Instead it relies on support from the OS or hardware (the hardware also needs to be Able to support the profile used to Encode the video, in the case of MP4).

The Portuguese translation is as follows:

To avoid patent issues, support for MPEG 4, H.264, MP3 and AAC is not built directly on Firefox desktop and mobile devices (Android and Firefox OS). Instead it relies on the support of the operating system or hardware (the hardware also needs to be able to support the profile used to encode the video, in the case of MP4).

In your case, it would be advisable to allow the format selection to be consumed according to the client - or convert its file base to Ogg Vorbis format, since all modern browsers support this format.

2

  • I really liked this lib, but it’s not very simple ): I’m looking for the best native alternative possible.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.