I’ve only looked at the results for video codecs, so each codec parameter given to the canPlayType() function only contained the unique identifier of the video codec. It’s just the first to be broken in such a way that actually prevents proper detection of codecs. You’ll notice there are still quite some problems and Internet Explorer isn’t the only one affected.
The rest of this article is a detailed explanation of how the different browsers respond to various canPlayType() requests. The only way to be even more sure is to actually try to load the file and see if it fails or succeeds. This answer is as definitive an answer as you will get.
The reason why it isn’t a simple ‘yes’ is that there are other factors that determine whether or not a file can be played by a browser. The string probably is the best answer you can get. So if you specify only the MIME type you should expect only an maybe answer at best. The reason for this is that some containers support many codecs and the browser may only support one of them.
This has become quite important because not every browser supports the same codecs. The HTML5 specification does not specify which combination of codecs and containers should be supported in a browser, but it does provide a way to detect which actually are. Combined with the unique string for Baseline Profile H.264 video you would get the following identifier: video/mp4 codecs="avc1.42E01E, mp4a.40.2". The unique string for Low-Complexity AAC audio is mp4a.40.2.
Firefox video codec mp4#
The MIME type for the MP4 container is video/mp4. For example Baseline Profile H.264 video has a unique string of avc1.42E01E and High Profile H.264 video has a unique string of avc1.64001E. This only makes the unique string for each codec a bit more lengthy, but the principle is the same. H.264, MPEG-4 and AAC are a bit more complicated, because these codecs use profiles which determine which features are used by a codec. The identifier would look like this: video/ogg codecs="vorbis, theora" The unique string for the Theora codec is theora and the string for the Vorbis codec is vorbis. That identifier contains the MIME type of the container and the codecs parameter, a combination of unique strings for each of the codecs that have been used.įor example, the MIME type for the Ogg container is video/ogg.