I am trying to run the author’s code for Chapter 19 on the emulator. Instead of a live preview from my webcam, I get a black screen with the following errors:
emulator: ERROR: _camera_device_read_frame_callback: Device ‘AndroidEmulatorVC0’ is unable to grab a frame: 0
emulator: ERROR: _camera_client_query_frame: Unable to obtain video frame from the camera ‘AndroidEmulatorVC0’: No error.
Text: Error 100
I notice that there are no instructions in the book to set up the AVD to use a webcam as the camera. I did the following to set up mine. Please correct me if I am wrong.
Device: Galaxy Nexus
Target: Android 4.3 - API Level 18
Front Camera: None
Back Camera: Webcam0
SD Card: 200MB
Executing emulator -avd avdname -webcam-list from the command line produces the following message:
List of web cameras connected to the computer:
Camera ‘webcam0’ is connected to device ‘AndroidEmulatorVC0’ on channel 0 using pixel format ‘BGR4’
Here is another interesting thing I observed. The camera works if I hit the Home button at the live preview screen and then start CriminalIntent again from the Home screen. However, when I try to take a picture by hitting the Take! button (chapter 20), it reverts back to the black screen with the above errors. Any insights into what is going on and how to make the webcam work properly with the emulator would be much appreciated.