Bug 44517
| Summary: | HTMLMediaElement.canPlayType gives false positives in Safari | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Niels Leenheer (HTML5test) <info> |
| Component: | Media | Assignee: | Nobody <webkit-unassigned> |
| Status: | UNCONFIRMED | ||
| Severity: | Normal | CC: | ahmad.saleem792, destra, eric.carlson, jer.noble |
| Priority: | P2 | ||
| Version: | 528+ (Nightly build) | ||
| Hardware: | All | ||
| OS: | All | ||
| URL: | http://beta.html5test.com/testcases/video/ | ||
Niels Leenheer (HTML5test)
When a codecs parameter is provided and the MIME type is supported, canPlayType() always returns "probably" regardless of the contents of the codecs parameter. This results in false positives and makes it impossible to reliably detect codec support in Safari.
For example:
v=document.createElement('video');
v.canPlayType('video/mp4')
-> maybe // correct
v=document.createElement('video');
v.canPlayType('video/mp4; codecs="avc1.42E01E"')
-> probably // correct
v=document.createElement('video');
v.canPlayType('video/mp4; codecs="theora"')
-> probably // incorrect
v=document.createElement('video');
v.canPlayType('video/mp4; codecs="iv50"')
-> probably // incorrect
The canPlayType() function should only return "probably" when the codecs parameter represents an actually supported codec. Unknown codec parameters should return an empty string.
See also: http://rakaz.nl/2010/06/problems-with-html5-video-codec-detection.html
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Niels Leenheer (HTML5test)
I filed a similar bug against Chrome:
http://code.google.com/p/chromium/issues/detail?id=53193
The problem is Chrome is slightly different from the problem in Safari. Chrome only accepts codecs parameters that are supported, but allows MIME type and codec mismatches. For example Theora in an MP4 container will return "probably".
Unlike Chrome, Safari will also accept codecs parameters that are not supported at all. For example:
v=document.createElement('video');
v.canPlayType('video/mp4; codecs="foobar"')
-> probably // incorrect
Ahmad Saleem
We still fail some WPT Tests for 'canPlayType', so I think this is still applicable:
https://wpt.fyi/results/html/semantics/embedded-content/media-elements/mime-types/canPlayType.html?label=master&label=experimental&aligned=&q=canplaytype
http://wpt.live/html/semantics/embedded-content/media-elements/mime-types/canPlayType.html