Download

Auto Focus using Android Camera Plugin - is it possible?

The title says it all really.

I’m using the built-in Android Camera Player plugin (version 2.0 , UE 4.21) and can stream the backfacing camera through to a Media Texture and display it at runtime but it’s kind of pointless as it’s out of focus.
Does anyone know how to enable android’s android.hardware.camera.autofocus feature via this plugin? Or any other way?

I found an old plugin here which mentions being able to edit an xml file in the plugin to enable it but that’s a 3rd party plugin and it won’tr compile for recent versions of the engine.

Any ideas?

I could use the ARCore plugin but it’s not compatible on the device/s I need it for.

Thanks

That old plugin you mention. Should still work for recent versions of the engine. Can I ask the difficulties that you are having?

Well maybe it is late but it can help other people who face same problem. I’ve solved android camera focus problem. There is CameraPlayer14.java file at this folder “C:\Program Files\Epic Games\UE_X.XX\Engine\Plugins\Media\AndroidCamera\Source\AndroidCamera\Java\src\com\epicgames\ue4”. You should add line “param.setFocusMode(“continuous-picture”);” after line 520. And this should add auto focus. I think this must be added to official plugin.

Thanks vristok, what is the the compile procedure?

It compiles during android packaging. Also I had a problem with low FPS. I solved it changing the same CameraPlayer14.java file at lines 516 and 517. I changed these lines on:
width = previewSizes.get(0).width;
height = previewSizes.get(0).height;

P.S.
You have to consider that you should make this changes every time you install new engine version, so it is a good idea to save changed file anywhere.