微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何在Chrome for iOS中使用getUserMedia

我正在开发一个简单的应用程序,在此我尝试使用getUserMedia访问摄像头和麦克风.它适用于台式机Chrome和 Android Chrome,但它在iPhone和iPad Chrome中无效.

navigator.getUserMedia = navigator.getUserMedia
        || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia;
var constraints = "";
if (mediaType === "audio,video") {
    constraints = {
        audio : true,video : true
    };
} else {
    constraints = {
        audio : true,video : false
    };
}
navigator.getUserMedia(constraints,successCallback,errorCallback);

解决方法

… but it’s not working in iPhone and iPad Chrome.

iPhone或iPad上的Chrome应用程序未运行“完整”版本的Chrome.它的功能仅限于iOS平台.所以getUserMedia等可能要到Safari/Apple supports it才能使用.

Quoting from another question

Apple policy forces other browser to use their version of webkit which does not support webRTC,so you will not have webRTC support in a web app on iOS anytime soon. Activity in webkit hints as a change,but time for this to land,it will be months.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐