我什么时候必须重新锁定相机?
android.hardware.Camera 告诉我,如果我“不录制视频”,那么我“可能不需要此方法”。嗯,我正在录制视频。
unlock()
应该在“调用 android.media.MediaRecorder.setCamera(Camera) 之前”调用。这很简单;我可以将 unlock()
调用紧接在 setCamera()
调用之前。但是什么时候调用lock()
合适呢?紧接着setCamera()
?在MediaRecorder.stop()
之后?或者在其他时间?我如何知道何时需要锁定相机?
android.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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以在 MediaRecorder.stop() 之后使用重新连接而不是锁定。
You can use reconnection instead of lock after MediaRecorder.stop().
你不需要调用lock(),当你打开相机时,Camera对象默认被锁定,除非调用unlock()。因此,基本上,当您想防止在释放相机之前没有人可以使用相机服务时,就会调用 lock() 方法。
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.