[whatwg] Scripted querying of <video> capabilities

Maciej Stachowiak mjs at apple.com
Thu Oct 16 00:14:07 PDT 2008


On Oct 15, 2008, at 1:44 AM, Ian Hickson wrote:

>
> On Tue, 14 Oct 2008, Robert O'Callahan wrote:
>> On Tue, Oct 14, 2008 at 12:13 PM, Maciej Stachowiak <mjs at apple.com>  
>> wrote:
>>
>>> While the underlying media frameworks can't necessarily answer,  
>>> "if I
>>> give you a file with this MIME type, can you play it?", they can at
>>> least give a yes/no/maybe answer, which can still be quite helpful,
>>> since the UA will know it does not need to check some media  
>>> streams at
>>> all.
>>
>> I agree. If the API lets us answer "maybe", there is not much need or
>> temptation to lie, and we can still return information that could be
>> useful to scripts.
>
> I have added window.navigator.canPlayType(mimeType). It returns 1,  
> 0, or
> -1 to represent positive, neutral, and negative responses.

This API would be tempting to treat as a boolean but would of course  
do completely the wrong thing. I think it would be better to either  
ensure that the positive and neutral responses are both values that JS  
would treat as true (for instance make the values true, "maybe" and  
false), or else make all of the return values something self- 
descriptive and symbolic (for instance the strings "yes", "maybe" and  
"no"). I think 1, 0, -1 are neither clear nor likely to be in any way  
beneficial for perforamnce.

Regards,
Maciej




More information about the whatwg mailing list