W3C home > Mailing lists > Public > whatwg@whatwg.org > August 2008

[whatwg] Scripted querying of <video> capabilities

From: Tim Starling <tstarling@wikimedia.org>
Date: Thu, 07 Aug 2008 16:53:56 +1000
Message-ID: <489A9C04.9040006@wikimedia.org>
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

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:04 UTC