在iOS 6中使用getUserMedia / Stream API [英] Using getUserMedia/Stream API with iOS 6
问题描述
我正在尝试构建一个网络应用程序,允许用户在iPad上使用内置摄像头拍摄自己的照片或视频,然后将其发布到Facebook。到目前为止,我在Safari for iOS 6或Chrome应用程序中测试 getUserMedia()
时没有运气。
I am trying to build a web app that will allow users to use the built in camera on an iPad to take a picture or video of themselves and then post it to Facebook. So far I have had no luck when testing getUserMedia()
in Safari for iOS 6 or the Chrome app.
此信息图表显示Safari不支持iOS 6,但它可以与Chrome配合使用,不是吗?
This info graphic shows that it is not supported by Safari with iOS 6 but it should work with Chrome, no?
我们非常感谢任何帮助。
Any help would be much appreciated.
推荐答案
目前,移动版Safari从相机(或照片卷)获取图像的唯一方法是使用输入元素。这很简单:
Currently the only way for mobile Safari to get an image from the camera (or photo roll) is with an input element. It is quite simple:
<input id="image-picker" type="file" accept="image/*" />
然后在js中:
$("#image-picker").change( function (event) {
var files = event.target.files;
if (files.length>0) {
// Do something with files[0]
}
});
这篇关于在iOS 6中使用getUserMedia / Stream API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!