Santiago P
Santiago P

Reputation: 5

Trying to use SoundJS and jQuery's selectable but the sound doesn't work on firefox

here is my problem, i'm trying to use SoundJS (A library that i used before several times) and jQuery's Selectable library, the wierd part is that all the funcions of Selectable are working, and the SoundJS funcions ONLY works on GOOGLE CHROME and "sometimes" in Opera (if i change the sounds to .ogg format).

Now, in SoundJS documentation, says that i can use a "creatjs.Sound.alternateExtensions =["ogg"] or mp3, and that's the way i actually work: mp3 files, and they "change" in firefox to .ogg ... But this time it is not working... So, i'll leave the function here so you can see what's going on and help me out.

Thank you.

    function creandoSonido()
{
    createjs.Sound.alternateExtensions = ["ogg"];
    var manifestSonidoMal = [{ id:"idSonidoMal", src: sonidoMal}];
    createjs.Sound.registerManifest(manifestSonidoMal, "");
    console.log(manifestSonidoMal);
    var manifestSonidoBien = [{ id:"idSonidoBien", src: sonidoBien}];
    createjs.Sound.registerManifest(manifestSonidoBien, "");
}

function sonidoIncorrecto()
{
    createjs.Sound.play("idSonidoMal");
}

function sonidoCorrecto()
{
    createjs.Sound.play("idSonidoBien");
}

And of course i call the function "sonidoCorrecto()" and "sonidoIncorrecto()" when i have to, to play it.

Thanks.

Upvotes: 0

Views: 175

Answers (1)

OJay
OJay

Reputation: 1239

There is a known issue with Firefox (noted in the SoundJS Docs) that it will fail to play mp3's. The current workaround is to pass .ogg as the primary sound file and make alternateExtensions mp3. Also note that the ogg and mp3 files all need to be in the same folder.

One final note, your not using manifest correctly. It would be more efficient like this:

var manifest = [{ id:"idSonidoMal", src: sonidoMal},
              { id:"idSonidoBien", src: sonidoBien}];
createjs.Sound.registerManifest(manifest , "");

Hope that helps.

Upvotes: 0

Related Questions