我需要使用一个字段才能让Android和iOS用户选择用相机拍照,我用jQuery附加了输入字段,但是如何进行功能检测,所以我只向浏览器显示该字段需要那种方法代替例如flash或getUserMedia?
类似的东西,
if (navigator.captureFeature) {
//append the input field
} else {
//device does not support capture=camera
}
答案 0 :(得分:-1)
修改:我发现了这个:
https://github.com/addyosmani/getUserMedia.js
也许这有帮助?
这看起来像你想要的:
http://www.html5rocks.com/en/tutorials/getusermedia/intro/
function hasGetUserMedia() { // Note: Opera is unprefixed. return !!(navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia); } if (hasGetUserMedia()) { // Good to go! } else { alert('getUserMedia() is not supported in your browser'); }