When must I re-lock the Camera?
android.开发者_Python百科hardware.Camera tells me, of lock()
and unlock()
, that I "probably do not need this method" if I "am not recording video." Well, I am recording video.
unlock()
is supposed to be called "before calling android.media.MediaRecorder.setCamera(Camera)." That's simple enough; I can just put the unlock()
call immediately before the setCamera()
call. But what is the right time to call lock()
? Immediately after setCamera()
? After MediaRecorder.stop()
? Or at some other time? How do I know when it's time to lock the Camera?
You can use reconnection instead of lock after MediaRecorder.stop().
You don't need call lock(), when you open a camera, Camera objects are locked by default unless unlock() is called. So basically lock() method is called when you want to prevent that no one can use camera service until you release the camera.
精彩评论