Android multiple camera preview

一个人想着一个人 提交于 2019-12-23 12:44:09

问题


Is it possible to broadcast the android camera preview into 2 different SurfaceView controls at the same time? I have seen some apps that show effects into different previews in real-time, how do they achieve that? I read about the TextureView, is this the view to use? where can I find examples of multiple simultaneous camera previews?

Thanks


回答1:


I don't think that it is possible to independently open 2 camera previews at the same time, as the camera is treated as a shared resource. However, it will be possible to draw to multiple SurfaceViews which is what the apps you describe do.




回答2:


Well, as they answered in this question, I downloaded the grafika project and revised the "texture from camera" example.

In the RenderThread is a Sprite2d atribute called mRect. I just make another instance called mRect2, and configuired it with the same parameters that mRect has, except the rotation, I put it to the double:

mRect.setRotation(rotAngle); mRect2.setRotation(rotAngle*2);

This is the result

There is still a lot of code to understand, but it works and seems a very promising path to continue by.



来源:https://stackoverflow.com/questions/17223507/android-multiple-camera-preview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!