has.js icon indicating copy to clipboard operation
has.js copied to clipboard

Specific audio format support checks fail on Firefox.

Open stephank opened this issue 15 years ago • 3 comments

On Firefox 3.6 and 4 beta 6 (tested on Ubuntu 10.10, 64-bit), the audio checks for a specific formats fail. This can be seen in has.js' test suite when adding the script tag for detect/audio.js.

The cause of this appears to be canPlayType returning the empty string (unsupported), while the format can actually be played. The strange thing is that this only happens during or on page load; ie. manually using the console on an about:blank page to execute (new Audio()).canPlayType('audio/ogg; codec="vorbis"') results in 'maybe'.

stephank avatar Oct 17 '10 20:10 stephank

'maybe' doesn't sound truthy. how are we interpreting this?

phiggins42 avatar Oct 17 '10 22:10 phiggins42

Everything but the empty string is true. The string is simply !!'d.

It looks like the only way to get a better result from Firefox is after it has already played an Vorbis file, after which canPlayType returns 'probably' (which is the best result according to the spec.)

stephank avatar Oct 18 '10 06:10 stephank

canPlayType is really weak because it is so wishywashy on its maybe, probably. I am for a more beefy solution or removing the tests if there is no good yes-no solution.

jdalton avatar Oct 23 '10 11:10 jdalton