[英]iOS 11 getUserMedia not working?
Apple released a statement that getUserMedia
will be fully functional on iOS 11. After installing iOS 11 Beta version 5, I do get a message that my website requests access to my camera and microphone, but it seems that the line: Apple 发布声明,
getUserMedia
将在 iOS 11 上完全正常运行。安装 iOS 11 Beta 版本 5 后,我确实收到一条消息,说我的网站请求访问我的相机和麦克风,但似乎是这样的:
video.src = window.URL.createObjectURL(stream);
or:或:
video.srcObject = stream;
Does not work.不起作用。 No errors, no exceptions, simply no picture from the phone's camera.
没有错误,没有例外,只是没有来自手机相机的照片。
Here's my full script:这是我的完整脚本:
$(function () {
video = document.getElementById('vid');
navigator.getUserMedia = navigator.getUserMedia ||
navigator.webkitGetUserMedia ||
navigator.mozGetUserMedia;
navigator.getUserMedia(
{
audio: true,
video: { facingMode: "user" }
}, function (stream) {
video.srcObject = stream;
//video.src = window.URL.createObjectURL(stream);
},
function (err) {
alert(err.name);
});
});
HTML: HTML:
<video id="vid" muted autoplay></video>
Has anyone got it working?有没有人让它工作? Any ideas would be appreciated.
任何想法将不胜感激。
Solved it by using the following:使用以下方法解决了它:
$(function () {
video = document.getElementById('vid');
video.style.width = document.width + 'px';
video.style.height = document.height + 'px';
video.setAttribute('autoplay', '');
video.setAttribute('muted', '');
video.setAttribute('playsinline', '');
var constraints = {
audio: false,
video: {
facingMode: 'user'
}
}
navigator.mediaDevices.getUserMedia(constraints).then(function success(stream) {
video.srcObject = stream;
});
});
Can this be done using audio? 可以使用音频吗? Meaning will getUserMedia still work for iOS in case of getting user to record audio via their microphone ?
这意味着在让用户通过麦克风录制音频的情况下,getUserMedia仍适用于iOS吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.