[ACCEPTED]-How to use web camera in android emulator to capture a live image?-simulator

Accepted answer
Score: 14
  1. Download all the source files listed on the page: CameraSource, GenuineCamera, HttpCamera, SocketCamera, BitmapCamera, and WebcamBroadcaster.
  2. Create a package in your project called com.tomgibara.android.camera and place the first 4 source files inside.
  3. Download JMF from here and install it.
  4. Compile WebcamBroadcaster using the following command: "C:\Program Files (x86)\Java\jdk1.6.0_15\bin\javac.exe" -classpath "C:\Program Files (x86)\JMF2.1.1e\lib" WebcamBroadcaster.java or what's equivalent to it.
  5. Run it with the following command and keep it running: java "-Djava.library.path=C:\Program Files (x86)\JMF2.1.1d\lib" WebcamBroadcaster
  6. Use the following code in your program:
CameraSource cs = new SocketCamera("", 9889, 320, 240, true);
if (!cs.open()) { 
/* deal with failure to obtain camera */ 
while(/*some condition*/) {   
cs.capture(canvas) //capture the frame onto the canvas

PS: I haven't been able to test this because 3 I'm getting an error when I run WebcamBroadcaster.

PPS: I 2 just started experimenting with Android 1 today so all this could be wrong.

More Related questions