Closed jp1017 closed 8 years ago
Hi,
You need to use IFrameCallback
from com.serenegiant.usb.IFrameCallback;
In onConnect
method. add this line before camera.startPreview()
camera.setFrameCallback(mIFrameCallback, UVCCamera.PIXEL_FORMAT_RGB565/*UVCCamera.PIXEL_FORMAT_NV21*/);
Then, you can receive each frame via ByteBuffer
. In order to record videos, you much implement ourself.
final Bitmap bitmap = Bitmap.createBitmap(UVCCamera.DEFAULT_PREVIEW_WIDTH, UVCCamera.DEFAULT_PREVIEW_HEIGHT, Bitmap.Config.RGB_565);
private final IFrameCallback mIFrameCallback = new IFrameCallback() {
@Override
public void onFrame(final ByteBuffer frame) {
frame.clear();
synchronized (bitmap) {
bitmap.copyPixelsFromBuffer(frame);
}
mImageView.post(mUpdateImageTask);
}
};
private final Runnable mUpdateImageTask = new Runnable() {
@Override
public void run() {
synchronized (bitmap) {
mImageView.setImageBitmap(bitmap);
}
}
};
Thanks.
Q: How to take photos and videos?