从HTML / Angular应用程序访问移动相机

Var*_*run 2 html5 camera android-camera angular

我想从我在html5 / angular上构建的应用程序访问移动后置摄像头。我曾经使用过, <input type="file" accept="image/*" capture="camera" />但它总是先打开前置摄像头,然后再打开后置摄像头,是否有办法始终打开后置摄像头?

nip*_*777 8

您应该能够使用捕获属性在前后摄像头之间进行选择。

对于后置摄像头:

<input type="file" accept="image/*" capture="environment">
Run Code Online (Sandbox Code Playgroud)

对于前置摄像头,您应该可以使用:capture="user"或只是捕获。

如果您愿意,可以在这里阅读更多内容:https : //developers.google.com/web/fundamentals/media/capturing-images/