简体   繁体   English

如何通过网络应用访问我的安卓智能手机的前后摄像头?

[英]How can I access my android smartphone's both front and rear camera through a web app?

I want to access my android smartphones both front and rear camera through a web app.我想通过网络应用访问我的安卓智能手机的前置和后置摄像头。 I came across a web app in Jsfiddle which I modified according to my need and was trying on my android phone to access my android front and rear camera but was unable to do.我在 Jsfiddle 中遇到了一个网络应用程序,我根据需要对其进行了修改,并尝试在我的 android 手机上访问我的 android 前后摄像头,但无法做到。

Please visit this web app at : https://jsfiddle.net/cf90az9q/19/请访问此网络应用程序: https : //jsfiddle.net/cf90az9q/19/

I am viewing this app from chrome browser version:53 on my android smartphone.我正在我的 android 智能手机上从 chrome 浏览器版本:53 查看这个应用程序。 Here the button Switch Camera is intended to change from front camera to rear and vice versa on every click.此处的“切换摄像头”按钮旨在在每次单击时从前置摄像头更改为后置摄像头,反之亦然。

If I attach 2 webcams to my desktop and try to access the cameras , I am able to do so without any problem.如果我将 2 个网络摄像头连接到我的桌面并尝试访问这些摄像头,我可以毫无问题地这样做。

But when I try on my mobile by visiting the above web address, I am able to access my mobiles rear camera but when I click again to access my front camera, a black screen is displayed and hence I am unable to access.但是当我通过访问上述网址尝试使用我的手机时,我可以访问我的手机后置摄像头,但是当我再次单击访问我的前置摄像头时,显示黑屏,因此我无法访问。 Can someone please tell me how can I access both my android cameras.有人可以告诉我如何访问我的两个安卓相机。

A small note : Following line of code at line no.141 in javascript section toggles between 0 and 1 for every click and here '0' refers to front camera and '1' refers to rear camera.一个小提示:javascript 部分第 141 行的代码行在每次点击时在 0 和 1 之间切换,这里的“0”指的是前置摄像头,“1”指的是后置摄像头。

        v = (v?0:1);

You can't access both cameras simultaneously on most Android devices.您无法在大多数 Android 设备上同时访问两个摄像头。 The only ones i know of that let you access both at the same time are the HTC m8, the OnePlusOne and the Motorola Nexus 6.我所知道的唯一能让您同时访问两者的是 HTC m8、OnePlusOne 和摩托罗拉 Nexus 6。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用 JavaScript 从前后摄像头捕获图像? - How to capture image from both front and rear camera using JavaScript? 如何从网页访问iPhone的相机? - How can I access a iPhone's camera from a web page? 如何在可示教机器上使用后置摄像头而不是前置摄像头 - How to use the rear camera instead of the front camera on a teachable machine Android 使用 JavaScript 从前置摄像头到后置摄像头的 Chrome 切换 - Android Chrome Switch from Front to Rear camera using JavaScript Js如何访问移动前置摄像头并录制视频? - How can I access mobile front camera and record a video in Js? 如何从第二个Web视图访问应用程序的离子存储(localForage)? - How can I access my app's ionic-storage (localForage) from a second web view? 如何在渐进式Web应用程序中选择后置摄像头? - How to select rear-facing camera on a progressive web application? 如何使用JavaScript启用或禁用智能手机的GPS服务? - How can I access smartphone's gps service is enabled or disabled with javascript? 如何使用 webcam.js 在移动设备中打开后置摄像头? - How can I open rear camera in mobile device using webcam.js? 我如何使我的 web 应用程序仅对智能手机用户可用 - How i make my web application only available to smartphone user
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM