WebPlatformTest / HTML5test

How well does your browser support HTML5?
https://html5test.com
MIT License
995 stars 193 forks source link

MP3 and AAC codec detection uses wrong mimetypes #2

Closed NielsLeenheer closed 14 years ago

NielsLeenheer commented 14 years ago

I was looking at http://html5test.com/ this afternoon and was a little confused when it reported that Safari on Mac OS X does not support MP3 or AAC codecs within those tags. Looking at the source it seems that this support is detect like so:

                var r = !!this.element.canPlayType && this.canPlayType('audio/mpeg3;');

And:

                var r = !!this.element.canPlayType && this.canPlayType('audio/x-m4a;');

I'm curious where you got these MIME types from. The Wikipedia pages about MP3 and AAC do not list either of those MIME types as representing those formats. If I make the following change to html5test.com:

--- html5test.com.orig.html 2010-04-11 14:13:04.000000000 -0700
+++ html5test.com.html  2010-04-11 14:12:52.000000000 -0700
@@ -472,7 +472,7 @@
            },

            t2: function() {
-                   var r = !!this.element.canPlayType && this.canPlayType('audio/mpeg3;');
+                   var r = !!this.element.canPlayType && this.canPlayType('audio/mpeg;');
                this.section.setItem('MP3 codec support', r)
                return r ? 2 : 0;
            },
@@ -484,7 +484,7 @@
            },

            t4: function() {
-                   var r = !!this.element.canPlayType && this.canPlayType('audio/x-m4a;');
+                   var r = !!this.element.canPlayType && this.canPlayType('audio/aac;');
                this.section.setItem('AAC codec support', r)
                return r ? 2 : 0;
            },

… then Safari is correctly detected as supporting MP3 and AAC in the

Is there some reason that you expect the MIME types that you're using to work?

Thanks,

NielsLeenheer commented 14 years ago

It seems this is more complicated than applying this patch. At least Chrome does not support the audio/aac mime type, but it does recognize audio/x-m4a.

Which is wrong and which is right? Or are they both right?

NielsLeenheer commented 14 years ago

Should be fixed in bd9c462c18ad9e0919d9fc0a6dd77dfa663b123c I now check for both audio/aac and audio/x-m4a.