如何在iOS版Chrome中使用getUserMedia [英] How to use getUserMedia in Chrome for iOS

查看:146
本文介绍了如何在iOS版Chrome中使用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);


解决方案


...但它不适用于iPhone和iPad Chrome。


iPhone或iPad上的Chrome应用程序未运行完整版本的Chrome 。它的功能仅限于iOS平台。因此,在 Safari / Apple支持之前, getUserMedia 等等可能无法使用。它



引用另一个问题苹果政策强制其他浏览器使用其不支持webRTC的webkit版本,因此您不会在Web应用程序中拥有webRTC支持iOS上的任何时间。 webkit中的活动提示作为一种改变,但是需要时间来降落,这将会持续数月。



I am developing a simple application, in this I am trying to access camera and microphone using getUserMedia. Its working fine for me in desktop Chrome and Android Chrome but it's not working in iPhone and 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.

The chrome app on your iPhone or iPad is not running "a full" version of chrome. It's capabilities are limited to the iOS platform. So getUserMedia and the like probably won't be available until 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.

这篇关于如何在iOS版Chrome中使用getUserMedia的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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