检测浏览器对HTML Media Capture的支持 [英] Detect browser support for HTML Media Capture

查看:146
本文介绍了检测浏览器对HTML Media Capture的支持的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



如何检测HTML Media Capture *的浏览器支持?


How can I detect browser support for HTML Media Capture* ?



传统的测试方式支持某个属性似乎无法在某些设备上运行(在iPad和Google Nexus上测试):


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;
  } 



有一个对Modernizr的测试,但它没有'似乎是可靠的(它使用相同的原理):
https://github.com/Modernizr/Modernizr / pull / 909

__

(*)有关HTML Media Capture的更多信息:

(*) More info on HTML Media Capture:

http://www.w3.org/TR / html-media-capture /

http:/ /www.html5rocks.com/en/tutorials/getusermedia/intro/#toc-round1

推荐答案

我希望我错了,但似乎我们无法进行此检测...

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

(与Streaming / GetUserMedia API不同)的org / TR / html-media-capture /rel =nofollow>最后一篇论文发布于去年(2014年),从未发布过退出了草稿...

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...

评论从2012年开始请求在Firefox中实现此功能明确指出:

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


[T]这里没有真正需要实现的。它应该是免费的Android Intent系统。我们应该调用ACTION_IMAGE_CAPTURE / ACTION_VIDEO_CAPTURE的意图。

[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...

因此,检测此功能的唯一方法似乎是针对已知支持设备的UserAgent匹配......

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

这篇关于检测浏览器对HTML Media Capture的支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆