Native Camera for Android & iOS [Open Source]

Thanks for the fast reply bro, i fixed the darkness of the picture , the only problem is after i take the picture, the image that return is too small, i have been playing with this code line

quad.transform.localScale = new Vector3( 1f, texture.height / (float) texture.width, 1f );

how can i do to make the image get the phone width and height? to adapt on all phones

this is the image i get later from taking with native camera fix hosted at ImgBB — ImgBB

Oh, you mean small like that, lol. I thought you were talking about the resolution of the image. The code that instantiates that small quad is for demonstration purposes only; if you want to show the image in full screen, you should ideally create a full screen RawImage object and assign the camera texture to its texture property.

Bro could you be more explicit please? i did all ok but still can´t do that, image still little

In essence, you can use the Texture2D texture object however you want. For example, to display the captured image in full screen, add a public UnityEngine.UI.RawImage rawImg; variable to your script and call rawImg.texture = texture; inside NativeCamera.TakePicture. Then, create a fullscreen UI-Raw Image object in your scene and assign it to the Raw Img variable of your script.

1 Like

Bro simply amazing, thanks a lot for the help, you are a nice man, cheers bro, i did it ok :smile:

Hello ! I’d like to know if I can record video without on screen feedback ? I’d like to record the from camera while the user is playing.

Unfortunately not. This plugin can record videos with device’s native camera app only.

Hi I just wanted some clarity…

First of all, thank you fro creating such amazing free assets, I’m already using the camera to take a screenshot for an AR project.

I’d also like to add in a feature where the use can record the video feed of their AR experience on android/iso similar to the ARStickers app.

Is there a way to record the camera feed and include the UI and AR parts? I tried to use the Record method, but the app froze maybe because the camera is already open…

Do you have any recommendations for recording camera feed with the UI and AR… Or continuous screen recording?

Thank you

For screen recording, there are two powerful solutions:

  • Everyplay - developed by Unity team but discontinued, free, tested it myself with Vuforia AR
  • NatCorder - paid, haven’t tested it myself but has a 5-star rating
1 Like

Hello,

We’ve run into a bit of a problem on Android with 16M (5312x2988, 16:9) pictures crashing the app in the background. 12M (3984x2988, 4:3) and below seem to work fine on our test device. Currently using Unity 2018.2.8f1. The device logs seem pretty barren of anything helpful.

iOS and video recording work fine.

Any help or ideas would be much appreciated, thanks!

If you don’t do anything in NativeCamera’s callback, does it still crash the app? If not, then try putting Debug.Log lines in between each line in the callback function to pinpoint the problematic line.

The callback into Unity is never called when taking a 16M picture. If the crash happened in our app’s callback function it’d be much easier to find the problem, but as it is I can’t get any decent logs out. From the user’s perspective, after pressing “Ok” in the camera to confirm the photo taken, the app restarts itself in the background and the callback cannot find its intended target since it doesn’t exist anymore. At least that’s what I’m assuming is what happens.

It seems like Android OS kills Unity app to free up some memory. This happens when device runs out of memory. Please try your app on a newer device or a more powerful emulator and see if the issue persists.

Thank you for the information, greatly appreciated!

Hi,
When using the provided TakePicture example code I witnessed the images were available in my Android’s gallery. That worked for awhile, but now I no longer see the images added to gallery. I’ve tracked down the path on my device to see if the image exists and it appears to not be there. Maybe I’m doing something wrong, or witnessed an anomaly that should never have happened. Either way just curious if there would be a way for me to provide a path to save a captured image to the file system? Thanks

Images shouldn’t appear in the gallery, a segment of the code is actually dedicated to deleting those images. In NativeCamera’s callback function, you can copy the file to a specific path, if you want.

Awesome thanks for the quick response. Now that i think of it I didnt see the images in the gallery using your plugin.

Hello, everything is working great with the asset but the video that is recorded doesn’t seem to be saved in memory, only the picture that is taken is being saved in device memory.
Thanks for all the work though, great job.

Do you mean that NativeCamera.RecordVideo’s CameraCallback returns a path that does not point to an existing file, or does it simply return null?

hey, there, looking at the image properties

#if !UNITY_EDITOR && UNITY_ANDROID
        string value = AJC.CallStatic<string>( "GetImageProperties", Context, imagePath );
#elif !UNITY_EDITOR && UNITY_IOS
        string value = _NativeGallery_GetImageProperties( imagePath );
#else
        string value = null;
#endif

string[] properties = value.Split( '>' );
if( properties != null && properties.Length >= 4 )

Are there any other properties accessible on that object other than the ones that are being returned? Specifically looking for the last modified date of the image.