This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 21977 - Swap isTypeSupported() parameter order so keySystem is first
Summary: Swap isTypeSupported() parameter order so keySystem is first
Status: RESOLVED FIXED
Alias: None
Product: HTML WG
Classification: Unclassified
Component: Encrypted Media Extensions (show other bugs)
Version: unspecified
Hardware: All All
: P2 normal
Target Milestone: ---
Assignee: David Dorwin
QA Contact: HTML WG Bugzilla archive list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-05-08 22:01 UTC by David Dorwin
Modified: 2013-05-24 23:40 UTC (History)
3 users (show)

See Also:


Attachments

Description David Dorwin 2013-05-08 22:01:52 UTC
The current draft has isTypeSupported(type, keySystem). The parameter order was carried over from the overloading of canPlayType(), where the first parameter was already defined, in v0.1b.

On one hand, the order makes sense:
 * The noun in the method name is "Type", which is the first parameter.
 * The first parameter is the same as MSE's isTypeSupported() method [1]

However, it seems much more likely applications would want to query |keySystem| without |type| than vice versa^.

The examples [2] show how querying just the |keySystem| strangely requires passing null as the first parameter:
  MediaKeys.isTypeSupported(null, "com.example.somesystem")
If we don't need to support querying just |type|, we could require at least one parameter, simplifying implementations, and support the above query as:
  MediaKeys.isTypeSupported("com.example.somesystem")

The check a combination, an application would call:
  MediaKeys.isTypeSupported("com.example.somesystem", mimeType)


^ Would applications ever want to query just |type| to determine if the UA supports encrypted content of that type without checking the key system? It seems applications would want to find supported key system(s) then check supported types for those key system(s).


[1] https://dvcs.w3.org/hg/html-media/raw-file/tip/media-source/media-source.html#widl-MediaSource-isTypeSupported-boolean-DOMString-type
[2] https://dvcs.w3.org/hg/html-media/raw-file/tip/encrypted-media/encrypted-media.html#dom-istypesupported
Comment 1 Joe Steele 2013-05-20 05:25:49 UTC
 > ^ Would applications ever want to query just |type| to determine if the UA
> supports encrypted content of that type without checking the key system? It
> seems applications would want to find supported key system(s) then check
> supported types for those key system(s).

Wouldn't the MSE version of isTypeSupported work fine for this? Or do you anticipate that the UA will support the video format but just not the encrypted version? It seems to me that the UA will not send a needkey if it does not recognize the format. 

I think your reasoning is sound - I would be fine with this change.
Comment 2 David Dorwin 2013-05-20 16:41:21 UTC
(In reply to comment #1)
>  > ^ Would applications ever want to query just |type| to determine if the UA
> > supports encrypted content of that type without checking the key system? It
> > seems applications would want to find supported key system(s) then check
> > supported types for those key system(s).
> 
> Wouldn't the MSE version of isTypeSupported work fine for this? Or do you
> anticipate that the UA will support the video format but just not the
> encrypted version? It seems to me that the UA will not send a needkey if it
> does not recognize the format. 

Yes, we should allow UAs to support formats via .src or MSE without supporting decryption of such formats. isTypeSupported() is likely to be called before media is provided, so relying on needkey will not work.
Comment 3 David Dorwin 2013-05-21 15:31:56 UTC
As agreed in the May 21st telecon, I will make this change.
Comment 4 David Dorwin 2013-05-24 23:40:44 UTC
As discussed in the May 21st telecon, the parameters have been swapped:
https://dvcs.w3.org/hg/html-media/rev/85fbfad2339e