使用 HTML5 启用后置摄像头 [英] Enable rear camera with HTML5

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

问题描述

我正在使用 MVC ASP.Net 4 HTML5 进行项目(默认浏览器是 google-chrome 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 2 I 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 启用后置摄像头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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