How can I detect browser support for HTML Media Capture* ?
The traditional way of testing if an attribute is supported doesn't seem to work on some devices (tested on iPad and Google Nexus):
var elm = document.createElement(input);
if (capture in elm) {
return true;
}
There's a test for Modernizr but it doesn't seem to be reliable (it uses the same principle):
https://github.com/Modernizr/Modernizr/pull/909
__
(*) More info on HTML Media Capture:
http://www.w3.org/TR/html-media-capture/
http://www.html5rocks.com/en/tutorials/getusermedia/intro/#toc-round1
type="file"
,accept="image/*"
,accept="video/*"
, etc), if that fails then I'd probably go with just going though the User Agent string and testing if the browser is a version that has support. Also, you don't have quotes around yourinput
orcapture
so it will error out because they will be undefined variables. – Directional