[whatwg] Scripted querying of <video> capabilities

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

Received on Wednesday, 6 August 2008 23:53:56 UTC