Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detect browser support for HTML Media Capture


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

like image 972
Luis Evrythng Avatar asked Jun 12 '13 16:06

Luis Evrythng


1 Answers

I hope I'm wrong, but it seems we won't be able to make this detection...

The last paper about this HTML MEDIA Capture API (which is different than the Streaming/GetUserMedia API), as been posted last year (2014), and never gone out of the drafts...

This comment from 2012 on a request to implement this feature in Firefox clearly states that :

[T]here is no real need to implement that. It should come for free with Android Intent system. We should just call in intent for ACTION_IMAGE_CAPTURE/ACTION_VIDEO_CAPTURE.

Which means that this feature comes from the OS directly, and that we as developers won't have any way to know if this will be available or not...

So the only way to detect this feature seems to be a UserAgent match against known supporting devices...

like image 198
Kaiido Avatar answered Nov 18 '22 20:11

Kaiido