android – 同时运行2个摄像头实例

我想知道是否有可能在
android中有2个摄像头预览实例.我的意思是同时运行2个摄像头实例.如果是这样,怎么会这样,是否需要在不同的线程上实现实例?我之前没有使用过相机API,所以如果我能对这个问题有所了解,我将不胜感激,所以我不会浪费时间.

谢谢. 最佳答案 无法与相机建立两个打开的连接 – 您必须锁定相机才能进行预览,并且只能锁定一次.事实上,如果您将相机锁定,并且您的应用程序在解锁之前崩溃,那么没有人可以使用相机!

http://developer.android.com/reference/android/hardware/Camera.html#open%28int%29

You must call release() when you are
done using the camera, otherwise it
will remain locked and be unavailable
to other applications.

RuntimeException: if connection to the
camera service fails (for example, if
the camera is in use by another
process).

也就是说,您当然可以注册预览回调并从单个相机实例中获取预览数据以在多个视图中使用.但请注意预览回调提供的原始byte []数据的YUV格式问题:Getting frames from Video Image in Android(请注意,预览数据来自相机驱动程序,可能因设备而异)

点赞