4 ms·
The proposed solution uses JS to check what formats the browser reports support for, in order to tailor the <audio>'s src attribute: if(!!(a.canPlayType &&
by gmac 16y ago
The proposed solution uses JS to check what formats the browser reports support for, in order to tailor the <audio>'s src attribute:
if(!!(a.canPlayType &&
a.canPlayType('audio/ogg; codecs="vorbis"')
.replace(/no/, '')))
a.src = "/sounds/ping.ogg";
else if ...
Does anyone know if this is more successful than the standard HTML5 way, which is to include in the <audio> element multiple <source> elements pointing to different formats?