1. 2015 is going to be a great year for Android! Why wait??
    Samsung Galaxy Note 5 | Samsung Galaxy S6 | HTC One M9
  2. New Forum Created: Samsung Gear VR!

Android 4.0.3 Browser - audio.canPlayType() not working ?

  1. rickygai

    rickygai New Member

    I am using Samsung Galaxy S2, Andriod 4.0.3 and below is HTML5 audio elements JavaScript to detect if Android default Browser support certain audio types of MP3, OGG and WAV.

    function OnAudioSupportGet (audio)
    var ext = "";
    if( audio.canPlayType("audio/ogg") =="probably" ||
    audio.canPlayType("audio/ogg") == "maybe")
    ext = "ogg";
    if( audio.canPlayType("audio/wav") =="probably" ||
    audio.canPlayType("audio/wav") == "maybe")
    ext = "wav";
    if( audio.canPlayType("audio/mp3") == "probably" ||
    audio.canPlayType("audio/mp3") == "maybe")
    ext = "mp3";

    return ext;

    Via html5test.com, it seems default Android Browser able to play MP3 but
    yet, it failed to be recognized at instructions above.

    Any help, link, hint or guideline will be appreciated :eek:)


Share This Page