[whatwg] Scripted querying of <video> capabilities
Tim Starling
tstarling at wikimedia.org
Wed Aug 6 23:53:56 PDT 2008
Robert O'Callahan wrote:
> That would be nice to have. Unfortunately DirectShow and Quicktime do
> not seem to expose the ability to enumerate supported codecs, so it
> might be hard to implement for some browsers.
>
> As things stand, you can use <source> elements to offer different
> formats, and you can try to play a stream and use script to detect if
> it fails to play.
DirectShow and QuickTime can add those interfaces at a later date. When
the backends develop this capability, there should be a standard way to
go the next step and expose it to JavaScript. Otherwise every
implementor will develop their own interface.
In fact, QuickTime already has enough query capabilities for Wikimedia's
purposes. Here is part of the JavaScript code I wrote to embed QuickTime:
// Detect XiphQT (may throw)
var xiphQtVersion = false, done = false;
try {
xiphQtVersion = videoElt.GetComponentVersion('imdc','XiTh', 'Xiph');
done = true;
} catch ( e ) {}
if ( done ) {
window.clearInterval( this_.qtTimers[params.id] );
if ( !xiphQtVersion || xiphQtVersion == '0.0' ) {
// ... show error message "no XiphQt" ...
}
// Disable autoplay on back button
this_.setParam( videoElt, 'AUTOPLAY', 'False' );
}
It works very well, but it's the sort of thing that I'd rather not have
to implement a dozen times for a dozen incompatible scriptable interfaces.
--
Tim Starling
Wikimedia Foundation
More information about the whatwg
mailing list