On Thu, Jul 9, 2009 at 10:35 PM, Robert O'Callahan<rob...@ocallahan.org> wrote: > 2009/7/10 Ian Fette (イアンフェッティ) <ife...@google.com> >> >> To me, this seems like a great test if "canPlayType" actually works in >> practice. In the perfect world, it would be great to do >> getElementById('video'), createElement, and >> then canPlayType('video/whatever','theora'). >> If this simple use case doesn't work, I would ask if it's even worth >> keeping canPlayType in the spec. > > var v = document.getElementById("video"); > if (v.canPlayType && v.canPlayType("video/ogg; codecs=vorbis,theora")) { > ... > } else { > ... > } > > should work great. Certainly does in Firefox.
It works. Except where it doesn't. It's the "where it doesn't" that counts. At the moment Safari has issues. Out of two widely used production browsers with HTML5 support, one is broken. Not good odds, but I'm hopeful for the future. There is also the potential problem of "It technically supports format X; but the browser developer never bothered testing X and its too buggy to be usable". My preference, however, is to start with the basic canPlayType test and then only eliminate known problems and to make the problem filtering as specific as possible with the assumption that future versions will get it right.