Question

I currently use html5 dom content generated in javascript to play some sounds in a webpage.

In firefox and google chrome browser there is no problem, everything works but on android devices I can't hear the sound (even though I use google chrome mobile).

I use ogg vorbis content (who is supported by my android device like the w3schools reports it, same for the "does it support" website and according to my test of audio's tag play.) All my functions are called rightly (console.log and alert test are already done), sound is enabled on my devices at all output and all the functions of audio's tag are at a good value when I launch the audio's element :

a.readyState => 4

a.currentSrc => right url

a.error => null

a.volume => 1

Have you already heard of similar problems ?

Thanks in advance.

links : my application : http://ci.worldheberg.com/test.html my javascript script : http://ci.worldheberg.com/test.js sources : edited (cannot post more than 2 links)

the code concerned :

// attente is an array who contain the time before launch each audio part

function playSound() {
    "use strict";
    console.log("play sound fonction");
    var actuel, i, fonction;
    actuel = -1;
    fonction = function () {
        actuel++;
        console.log(a = audios[actuel]);
        /*alert(a.readyState);
        alert(a.currentSrc);
        alert(a.error);
        alert(a.volume);*/
        a.volume = 1;
        a.play();
    };
    for (i = 0; i < audios.length; i++) {
        alert(attente[i]);
        window.setTimeout(
            fonction,
            (attente[i])
        );
    }
}
Was it helpful?

Solution

Ok

After a lot tried, I've finished to find what's the problem is.

For all people who have the same problem, check that your sampling frequency is in 44100 Hz (I don't seen anywhere this information but tried,...) chrome for computer has support more frequencies but default's android browser and chrome mobile does'nt support higher frequency.

I hope that my experience will be used for someone else.

thanks at all who have seen this message (I'm on this bug from more than 3 days)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top