[Bug 25923] isTypeSupported should be asynchronous

https://www.w3.org/Bugs/Public/show_bug.cgi?id=25923

--- Comment #32 from David Dorwin <ddorwin@google.com> ---
Building on the last paragraph of comment #31, maybe we should use a model
similar to Web MIDI's requestMIDIAccess() [1] and MIDIAccess Interface [2].

All isTypeSupported() queries are dependent on the key system, of which there
are likely to be few positive responses, so asynchronously checking for key
system support of the key system (but not media types) might be okay.

Below is a rough proposal based (somewhat) on the MidiAccess model.

navigator.requestKeySystemAccess("org.w3.clearkey").then(
  function(keySystemAccess) {
    // isTypeSupported() remains synchronous.
    if (keySystemAccess.isTypeSupported("keyids", "video/foo;
codecs='bar,baz'") ||
        keySystemAccess.isTypeSupported("keyids", "video/foo;
codecs='bar2,baz'")) {
      // This must be a separate asynchronous call so we do not need to load
the CDM in requestKeySystemAccess().
      return keySystemAccess.createMediaKeys();
    }
    // Throw to fall into the catch.
    ...
  }
).catch(
  function(error) {
    // Try the next key system.
    ...
  }
)


[1] http://www.w3.org/TR/webmidi/#obtaining-access-to-midi-devices
[2] http://www.w3.org/TR/webmidi/#midiaccess-interface

-- 
You are receiving this mail because:
You are the QA Contact for the bug.

Received on Tuesday, 16 September 2014 21:15:34 UTC