检测浏览器对HTML Media Capture的支持

编程入门 行业动态 更新时间:2024-10-26 11:19:54
本文介绍了检测浏览器对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的测试,但它没有'似乎是可靠的(它使用相同的原理): github/Modernizr/Modernizr / pull / 909

__

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

(*) More info on HTML Media Capture:

www.w3/TR / html-media-capture / http:/ /www.html5rocks/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的支持

本文发布于:2023-08-02 18:57:27,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1280278.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:浏览器   HTML   Capture   Media

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!