Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -
the current version of mozilla firefox 23.0.1, version not support play mp3 shoutcast streams tcp port different 80 (most common 8000 shoutcast 1.9.8).
i use flash when mp3 support not available in html5 audio, way detect is:
try{ var = document.createelement('audio'); r = !!(a.canplaytype && !!a.canplaytype("audio/mpeg; codecs=mp3").replace(/^no$/,'')) }catch(e){ r = false; }
the support mp3 shoutcast streams in firefox added in version 24.
a.canplaytype("audio/mpeg; codecs=mp3") = in chrome , firefox, chrome support, firefox not support, due current code detect not work firefox.
the current version of jquery support ie 6 1.10.2, version not has .browser
i think "stylized" way testing features , not querying browsers / versions, notwithstanding here see hard not violate "principle".
what "stylized" way of detect mp3 icy support without navigator.useragent in firefox?
there no sophisticated way detect it. news last stable firefox 24.0 support play shoutcast streams in mp3 html5 audio. best way detect support wrote:
function icy(){ try{ if(!navigator.useragent.match(/trident\/7\./) && $.browser.mozilla && $.browser.version < 24) return false;//https://bugzilla.mozilla.org/show_bug.cgi?id=869725 var = document.createelement('audio'); r = !!(a.canplaytype && !!a.canplaytype("audio/mpeg; codecs=mp3").replace(/^no$/,'')) }catch(e){ r = false; } return r; }
if use lastest jquery 1.10.2, need include jquery migrate plugin use $.browser
Comments
Post a Comment