Improved Android Camera
This is an Unreal Engine Plugin that enhances the official AndroidCamera plugin with features such as autofocusing, setting preview resolution and preview FPS.
Try demo project before reading. This demo was tested in Unreal 5.0 and 5.1.
How to use it?
1. Open the ‘Plugin Browser' in your project and search 'Android Camera Player' in the search box with 'ALL PLUGINS' selected, than enable the 'Android Camera Player' and 'Improved Android Camera Player'.
2. Create a Material called 'M_CameraView' and set the Material Domain to 'User Interface', than create a 'Texture Sample' node as the input of 'Final Color' of ’M_CameraView‘.
3. With 'Texture Sample’ node selected, click the drop-down list of 'Texture' on the 'Details' panel and select 'Media Texture' to create a MediaTexture called 'MT_CameraView'.
4. Open 'MT_CameraView' in the editor, set the 'Auto Clear' to true, and Create a 'Media Player' called 'MP_CamerPlayer' for it.
5. In Blueprint editor create an Object reference variable to the 'MP_CamerPlayer' and call the 'OpenUrl' function of ’Media Player' . After the camera is opened, OnMediaOpened Event will be called.
The Url parameter of OpenUrl can be obtained by calling the EnumerateVideoCaptureDevices function or manually filled in this form "vidcap://camera_id?width=xx?height=xx?fps=xx". All parameters are listed below:
camera_id: 'rear' or 'front'. They represent rear camera and front camera respectively.
width: all integer. Requested preview width.
height: all integer. Requested preview height.
fps: all integer. Requested preview fps.
Full example: 'vidcap://rear?width=1280?height=720?fps=30'.
6. Nodes exposed to Blueprint are listed below. They correspond to these functions of Android.
Examples of the use of these nodes can be found in Controller Blueprint class '/Game/AndroidCameraTest/Core/BP_TestController.BP_TestController' of the Demo project