I recently needed to develop a library for Mobile Processing for video capture. You can download the library and source.
Here is a quick example for using it (this example also uses my MVideoPlayback library):
import processing.core.*;
import com.mobvcasting.mvideocapture.*;
import com.mobvcasting.mvideoplayback.*;
public class MVideoCaptureTest extends PMIDlet
{
MVideoPlayback vidplay;
MVideoCapture vidcap;
byte[] videoData;
String captureKey = "Capture";
String stopCaptureKey = "Stop Capture";
String playKey = "Play Video";
public void setup()
{
softkey(captureKey);
vidcap = new MVideoCapture((PMIDlet)this);
vidcap.showCamera();
noLoop();
}
public void draw()
{
}
public void softkeyPressed(String label)
{
if (label.equals(captureKey))
{
//vidcap.timedCapture(20);
vidcap.startCapture();
softkey(stopCaptureKey);
}
else if (label.equals(stopCaptureKey))
{
vidcap.stopCapture();
}
else if (label.equals(playKey))
{
vidplay = new MVideoPlayback(this,videoData,"video/3gpp");
vidplay.showPlayer(0, 0, width, height);
vidplay.playVideo();
}
redraw();
}
public void libraryEvent(Object library, int event, Object data)
{
if (library.getClass().isInstance(vidcap) && event == MVideoCapture.CAPTURE_COMPLETE)
{
videoData = (byte[])data;
vidcap.hideCamera();
vidcap.closeCamera();
softkey(playKey);
redraw();
}
}
}
You can find more examples and a discussion on using this library from my course Mobile Media Week 7 notes