E/CameraHardwareSec(75): virtual android::status_t android::CameraHardwareSec::takePicture() : capture already in progress
E/PanicImageActivity(1750): java.lang.RuntimeException: takePicture failed
problem is before you call this method again in the TimerTask run method. you need to make sure that there is one not in progress. Some devices cameras are very slow on processing picture frames.
private final Semaphore mutex = new Semaphore(1);
try {
mutex.acquire();
mCamera.takePicture(null, null, new PictureCallback() {
public void onPictureTaken(byte[] data, Camera camera) {
try {
// Do something here
mutex.release();
}
catch(Throwable t) {
mutex.release();
}
});
}
catch (Throwable t) {
}
No comments:
Post a Comment