0

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.

  • 1
    Not really an answer, but maybe check out [howler.js](http://goldfirestudios.com/blog/104/howler.js-Modern-Web-Audio-Javascript-Library), it's a really robust audio library – Brett Gregson Oct 23 '14 at 14:39

1 Answers1

0

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.

OJay
  • 1,249
  • 7
  • 14
  • i already did that, to change .ogg as primary file, and change my manifest the way you told me, but the problem still there... (Thanks by the way) – Santiago P Oct 23 '14 at 16:31
  • hmm, thats puzzling. Are you waiting until the sounds are loaded before calling play? – OJay Oct 23 '14 at 16:55
  • Like "Pre-loading" it?, nope, i've got another 6 projects working "perfectly" the way i put it before... – Santiago P Oct 23 '14 at 18:15
  • k, waiting for it to load would be safer. If the audio has not finished loading, SoundJS will fail silently and your audio will not play. Future calls after load is complete should work. – OJay Oct 24 '14 at 16:59