在模拟器中启用 Android 网络摄像头
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11857006/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Android webcam enable in emulator
提问by Karthi
Hai I am new to the Android. I am using Android4 sdk. I can't enable webcam in Android emulator. Can anyone tell how enable it. Thanks.
海我是 Android 的新手。我正在使用 Android4 sdk。我无法在 Android 模拟器中启用网络摄像头。谁能告诉如何启用它。谢谢。
回答by ThomasW
There is a way to get this working use the Android Virtual Device Manager. You need to edit your AVD so that in the hardware section either "Configures camera facing front" or "Configures camera facing back" are available. One, but not both, of the values for these properties should be set to "webcam0" (or whatever is available). Then start your virtual device and use your webcam as an emulated camera.
有一种方法可以让这个工作使用 Android 虚拟设备管理器。您需要编辑您的 AVD,以便在硬件部分“配置面向前的摄像头”或“配置面向后的摄像头”可用。这些属性的值中的一个(但不是两个)应设置为“webcam0”(或任何可用的值)。然后启动您的虚拟设备并将您的网络摄像头用作模拟摄像头。
If you have both properties set to "webcam0" then you'll get a warning when you start up the virtual device and the front/back control won't be available in the camera app.
如果您将这两个属性都设置为“webcam0”,那么您将在启动虚拟设备时收到警告,并且相机应用程序中将无法使用前/后控制。
回答by Diego Torres Milano
Use emulator help to explore the available options
使用模拟器帮助探索可用选项
$ emulator -help 2>&1 | grep cam
-camera-back <mode> set emulation mode for a camera facing back
-camera-front <mode> set emulation mode for a camera facing front
-webcam-list lists web cameras available for emulation
and for example, use -webcam-list
to list the recognized cameras
例如,用于-webcam-list
列出已识别的摄像机
$ emulator -webcam-list @4.1
List of web cameras connected to the computer:
Camera 'webcam0' is connected to device '/dev/video0' on channel 0 using pixel format 'YUYV'
to see the emulation options for cameras
查看相机的仿真选项
$ emulator -camera-front help @4.1
emulator: ERROR: Invalid value for -camera-front <mode> parameter: help
Valid values are: 'emulated', 'webcam<N>', or 'none'