I just started android development and wrote a simple camera app using this tutorial: http://developer.android.com/guide/topics/media/camera.html#custom-camera
there i read: "Note: Starting with Android 4.0 (API level 14), the Camera.lock() and Camera.unlock() calls are managed for you automatically."
but what does this mean? my camera app supports Android 16 (4.1.2) and 17 (4.2.2) but if i discard the lock and unlock calls i get error from mediarecorder (-19). so how to let handle android it? or what does this mean "managed automatically"?
As android documentation states lock()
is called automatically for you in MediaRecorder.start()
.
I think that you couldn't remove the unlock() call because when the start()
method call the lock()
method on your camera, which is locked by default, it find the camera locket and so it rise a RuntimeException
.
Since API level 14, camera is automatically locked for applications in start(). Applications can use the camera (ex: zoom) after recording starts. There is no need to call this after recording starts or stops.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With