[whatwg] [mimesniff] Treating application/octet-stream as unknown for sniffing

Ian Hickson ian at hixie.ch
Thu Nov 29 10:24:25 PST 2012


On Thu, 29 Nov 2012, Gordon P. Hemsley wrote:
> 
> The apparent contradiction occurs when, e.g., an Opus file is tagged as 
> "application/octet-stream".
> 
> If I understand correctly, a UA would return "" when canPlayType() is 
> called against such a file—but then the file would actually play 
> because it is later sniffed as "application/ogg".

canPlayType() isn't called against files, it's called against MIME type 
strings.

The type "application/octet-stream" isn't a video or audio file type, so 
we know that the browsers can't play files actually of that type, any more 
than the browsers can't play videos of type text/css.

But when a file is labeled with that type, we know it's probably 
mislabeled, so we try to do something more useful.


On another note, the spec's current behavior with media elements and 
sniffing is actually very much up in the air, since the last time I worked 
on this I could not get browser vendors to agree on what to implement. 
Search for the note starting "This specification does not currently say 
whether or how to check the MIME types of the media resources".

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'


More information about the whatwg mailing list