本文介绍了启用后置摄像头,支持HTML5的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用MVC ASP.Net 4 HTML5项目(默认浏览器是谷歌铬v29.0.1547.57)我可以用这些工具进行交互,并拍摄照片,但只有前置摄像头,如何我可以使后置摄像头?平板电脑的特点:三星Galaxy Tab 2我希望你能帮助我。

I'm working on a project with MVC ASP.Net 4 HTML5 (default browser is google-chrome v29.0.1547.57) I can interact with these tools and take photographs but only with front camera, How I could enable rear camera?the characteristic of the Tablet: Samsung Galaxy Tab 2I hope you can help me

推荐答案

查看 https://simpl.info/getusermedia/sources/ ,显示如何使用选择源

Check out https://simpl.info/getusermedia/sources/ that shows how you can select sources using

MediaStreamTrack.getSources(gotSources);

您可以再选择源,并通过它作为可选到getUserMedia

You can then select the source and pass it in as optional into getUserMedia

var constraints = {
  audio: {
    optional: [{sourceId: audioSource}]
  },
  video: {
    optional: [{sourceId: videoSource}]
  }
};
navigator.getUserMedia(constraints, successCallback, errorCallback);

这是目前情况稳定Chrome浏览器和移动完全可用(如V30的)

It is now fully available in Stable Chrome and mobile (As of v30)

这篇关于启用后置摄像头,支持HTML5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-11 22:01