Search Unity

NatDevice - Media Device API

Discussion in 'Assets and Asset Store' started by Lanre, Dec 17, 2015.

?

Should we add exposure controls in v1.3? This means dropping support for iOS 7

Poll closed Jun 10, 2016.
  1. Yes

    9 vote(s)
    75.0%
  2. No

    3 vote(s)
    25.0%
  1. Leopold_p

    Leopold_p

    Joined:
    Oct 10, 2012
    Posts:
    4
    Hi, I am trying to find the APK file for the demo video record project. The link seems to be dead.

    I am researching the component best suited to record the video on an android device. I would need the component to be able to record the output from the android device camera and hopefully also be able to record a video stream coming to the device (something like recording a skype call).

    If the stream saving is not possible do you think it would be possible to record the output of the WebRTC Video Chat asset?
    Regards.
     
  2. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,973
    Good catch. I have updated it.
    NatCam supports this.
    NatCam provides no functionality for this. NatCam is solely a camera API.
    NatCam will only record video from the camera. It does not record from Unity, or any other sources.
     
  3. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,973
  4. CastryGames

    CastryGames

    Joined:
    Oct 1, 2014
    Posts:
    77
    please help me to make demo ar in opencv
     
  5. nathanqueija

    nathanqueija

    Joined:
    Apr 18, 2013
    Posts:
    19
    Hi,

    When I take the first picture with NatCam it is being rotated 90 degrees.
    What could be causing this?
     
  6. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,973
    I received your email. All photos should have the same orientation, provided that the app orientation is the same when the photos are taken. It should not change.
     
  7. Leopold_p

    Leopold_p

    Joined:
    Oct 10, 2012
    Posts:
    4
    Hi,
    Any release date on the 1.6 version?
    Regards.

    p.s. I have another problem, I used the gameobject form the ReplayCam example, but it is not working if the project is not a development build. if the flag is checked the asset works as it should, if not the asset freezes.I have attached a picture taken with the phone.

    Regards

    p.s.s. found the solution: multithreaded rendering was off. now it works as it should
     
    Last edited: Sep 19, 2017
  8. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,973
    Hi Leopold. Not yet. We were planning on doing so last week but we've had new bug fixes to implement. I'll post on the forum when 1.6 is submitted to Asset Store Review.
     
  9. eagleeyez

    eagleeyez

    Joined:
    Mar 21, 2013
    Posts:
    406
    I too look forward to the update.
     
  10. JuGGerNaunT

    JuGGerNaunT

    Joined:
    Oct 28, 2014
    Posts:
    9
    Hi. I have an issue with NatcamBehaviour on Android platform. After NatCam.Play(); method called, strange things start happenings with my model. Model consist of several SkinnedMeshRender and every 2nd frame they r rendering ignoring depth. Look screenshots.
    On Unity 5.4.2 everything works fine. This problem reprodusing on Unity 2017.1.1.
    It's reproducing only on Android. iOS and editor works fine.
     

    Attached Files:

  11. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,973
    We have fixed this in 1.6. The workaround for 1.5 is to enable multithreaded rendering in Player Settings.
     
  12. JuGGerNaunT

    JuGGerNaunT

    Joined:
    Oct 28, 2014
    Posts:
    9
    With enabled 'multithreaded rendering' 1.5 works fine, but another plugin in my project , which works with camera, don't work with this option :/ When will the 1.6 version?
     
  13. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,973
    We are targeting submitting 1.6 to Asset Store review tomorrow.
     
    ow3n likes this.
  14. TillmaniaLtd

    TillmaniaLtd

    Joined:
    Jan 29, 2013
    Posts:
    65
    Hey,

    I just got this asset and Im having issues. Whenever I try to call StartRecording I get this error along with a crash in Xcode:

    AVVideoSettings dictionary must specify a positive width'

    Please Advise
     
  15. JuGGerNaunT

    JuGGerNaunT

    Joined:
    Oct 28, 2014
    Posts:
    9
    Still 1.5f3? If i send u my invoice, can u send me 1.6 to my email?
     
    Last edited: Sep 27, 2017
  16. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,973
    We have resolved this over email.
     
  17. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,973
    1.6 should be out very soon. Please wait for Unity to review it.
     
  18. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,973
    ow3n likes this.
  19. eagleeyez

    eagleeyez

    Joined:
    Mar 21, 2013
    Posts:
    406
    Hi, I am trying to simulate a 90inch or 228.6cm diagonal TV screen in GearVR at 10 feet or 3.048 m distance.

    How do I do this in Natcam? For example turn the minicam example into the screen size and distance I want. I can do this in world space, but I need this in screen space.

    Thanks for any help here.

    It should simulate a 90inch, 1080p in 16:9 format at 3.048 m/10 feet distance from the viewer.
     
  20. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,973
    NatCam does not have anything to do with how you choose to display the camera preview. If you are using a UI panel to display the preview, you can set the canvas to world space and enforce your distance/screen size requirements. What you are looking to do is not pertinent to NatCam.
     
  21. eagleeyez

    eagleeyez

    Joined:
    Mar 21, 2013
    Posts:
    406
    Thanks for your reply, but I have tried everything and the NatCam preview just enlarges itself as soon as I press play or send to Android build.

    Please try it out for yourself.
     
  22. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,973
    The MiniCam example uses the NatCamPreview component to properly scale the preview panel. It sounds like you want to manually control this, so disable modify MiniCam to use ScaleMode.None when applying the NatCam preview texture.
     
  23. eagleeyez

    eagleeyez

    Joined:
    Mar 21, 2013
    Posts:
    406
    Thanks, but where do I disable modify MiniCam?
     
  24. eagleeyez

    eagleeyez

    Joined:
    Mar 21, 2013
    Posts:
    406
    Oh, I understand now. I found it in the NatCamPreview script, I just needed to change to none.

    public void Apply (Texture texture, Orientation orientation = Orientation.Rotation_0, ScaleMode scaleMode = ScaleMode.None) {public void Apply (Texture texture, Orientation orientation = Orientation.Rotation_0, ScaleMode scaleMode = ScaleMode.None) {

    Thank you for helping me.
     
  25. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,973
    You should modify MiniCam, not NatCamPreview. Revert your changes to NatCamPreview and in MiniCam's OnStart method, pass ScaleMode.None in the call to NatCamPreview.Apply.
     
  26. TobiasW

    TobiasW

    Joined:
    Jun 18, 2011
    Posts:
    91
    Hey Lanre!

    I have a question regarding PreviewFrame/PreviewBuffer and iOS vs other platforms.

    In PreviewFrame (NatCam.cs:78) you call PreviewBuffer and treat the result differently whether it is UNITY_IOS (BGRA) or not (RGBA), so I'd assume that the raw data returned is different on iOS.

    Meanwhile, in PreviewBuffer(colors) (NatCam.cs:61) you don't make that distinction and just directly put the result into a Color32 array.

    Am I misunderstanding something or should PreviewBuffer(colors) do some swizzling on iOS?

    Cheers,
    Tobias
     
    Last edited: Sep 30, 2017
  27. eagleeyez

    eagleeyez

    Joined:
    Mar 21, 2013
    Posts:
    406
    Thanks, I’ll do that.

    I am still having problems with this Unity UI mess. All I want to do is set the raw image for the NatCam to a specific distance in screen mode and a specific size, like said further up in my post. I have the NatCam preview working on android showing the live view but I want it as a 90” screen at 10 feet away from the camera.

    It would really, really help me if you could give me some insight to this.

    Theoretically really easy, but Unity new UI is crazy with canvas and scale.
     
  28. liusuwanxia

    liusuwanxia

    Joined:
    Jul 10, 2017
    Posts:
    3
    Hey, Lanre.

    I have noticed that `NatCam: Initialized NatCam 1.6 Legacy backend` is always appear in the Console after i update NatCam to 1.6. What does it mean?
     
  29. liusuwanxia

    liusuwanxia

    Joined:
    Jul 10, 2017
    Posts:
    3
    Hey, Lanre.

    Another problem is annoying me. I have migrated our projects to NatCam 1.6, but Callback OnStart() cannot be invoked . I am sure that there is no code modified, and no error is shown in the android monitor. I also run the visionCam example in the Professional folder and make sure it can run successfully. Is there any way helping me fix this issue?
     
  30. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,973
    Hi Tobias. That's a good catch. We were very reluctant to introduce the Color32 overload, so we did not pass it through testing (it is supposed to be marked as experimental, which it apparently wasn't). Anyway, I have opened an issue for swizzling the preview data to RGBA before copying it into the Color32 array. We'll get it done this week and submit a silent update to the Asset Store.
     
    TobiasW likes this.
  31. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,973
    It sounds like a trigonometry problem. You could manually set the pixel size of the canvas (and make your UI panel stretch to cover the entire canvas, effectively setting the pixel size of the panel). Check the Unity UI scripting reference.
     
  32. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,973
    You can ignore it. It is useful for us (when providing logs).
    Can you provide more information? It OnStart not being called? Are you running one of the NatCam example scenes?
     
  33. johncompass

    johncompass

    Joined:
    Sep 25, 2017
    Posts:
    2
    Hey Lanre.

    I would like to raise an issue on the huge performance dip when I made the build, for one Android Kitkat, Android Lollipop, and another Android Marshmallow. The camera playback seems to be smooth as it is on the KitKat, and Lollipop build, however, it takes a huge performance dip and starts stuttering in between frames on the Marshmallow built. Any feedbacks on this issue?
     
    Last edited: Oct 2, 2017
  34. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,973
    What devices are running which versions of Android?
     
  35. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,973
    We have decided not to fix this issue. Several issues arise that will compromise code quality and performance. If you need access to the Color32[] preview data, then use NatCam.PreviewFrame and call GetPixels32 on it.
     
  36. johncompass

    johncompass

    Joined:
    Sep 25, 2017
    Posts:
    2
    We are running:
    • Android 4.4 - on the Samsung galaxy J1 Ace
    • Android 5.0 - on the Samsung Note 4
    • Android 6.0.1 - on the Samsung Note 4, and Galaxy Tab S2.
     
    Last edited: Oct 3, 2017
  37. Stamp-Enzi

    Stamp-Enzi

    Joined:
    Aug 17, 2017
    Posts:
    17
    Hello Lanre!

    I just upgraded to 1.6.
    Examples are working (GreyCam, Minicam), test project doesn't work and I don't seem to find the difference.

    I'd send you the logs but there's no more output after the NatCam Dispatch: Initialized main dispatch

    In the examples that are working I get the NatCam Rendering logging entry. How is this triggered?

    NatCam Rendering Logging: Created ES3 GLRenderContext
    NatCam Logging: Camera 0 started session
    NatCam Logging: Detected first frame flag with preview size: 480x640 rotation: 1

    I'm pretty confused right now and I hope you can shed some light.

    edit: NatCam.OnStart and OnFrame isn't called for some reason. Again, it's called in the example.
     
    Last edited: Oct 3, 2017
  38. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,973
    This might be related to the graphics driver issue on the S7. If so, then turning off the PreviewData flag in NatCamAndroid.cs (in the 'Professional' directory) should fix it.
     
  39. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,973
    We will be pushing out a fix for this later today. In the mean time, the workaround is to tag one camera in your scene as the MainCamera.
    This is a direct consequence of the issue.
     
  40. PrisedRabbit

    PrisedRabbit

    Joined:
    Aug 14, 2012
    Posts:
    63
    v 1.6, device Samsung Galaxy Tab S 8.4 (SM-T700), preview feeds with stuttering, v 1.5 was ok.
     
  41. Leopold_p

    Leopold_p

    Joined:
    Oct 10, 2012
    Posts:
    4
    Hi,

    I am having problems disabling the autofocus, I tried this 2 code commands:
    Code (CSharp):
    1.  
    2. NatCam.Camera.FocusMode = FocusMode.Off;
    3. DeviceCamera.RearCamera.FocusMode = FocusMode.Off;
    4.  
    I also tried to set the the focus manually with:

    Code (CSharp):
    1.  
    2. NatCam.Camera.SetFocus(new Vector2(0.5f, 0.5f));
    3. DeviceCamera.RearCamera.SetFocus(new Vector2(0.5f, 0.5f));
    4.  
    No luck.

    But whenever I check the focus mode it always returns AutoFocus. I looked through the thread and didn't find an answer to this. Mabe my device does not support disabling autofocus? I am using a tablet(Samsung galaxy tab A6 10.1 - SM-T580) and a phone(Samsung S6 Edge - SM-G935F) for testing.
    Maybe I am missing something obvious, but I really can't seem to find a solution.
     
    Last edited: Oct 9, 2017
  42. JuGGerNaunT

    JuGGerNaunT

    Joined:
    Oct 28, 2014
    Posts:
    9
    In NatCamRenderDispatch.mm
    extern "C" void UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API UnityPluginLoad
    This non unique extern name conflict with other plugins with same extern. I renamed it by myself, but it would be better if non modified plugin wont conflict with others.
     
  43. Camille-Dahdah

    Camille-Dahdah

    Joined:
    Jun 27, 2015
    Posts:
    1
    Hi Lanre,
    I recently updated NatCam Pro from 1.5 to 1.6, but I can't seem to figure out how to save video to gallery with the latest update.

    I would really appreciate if you could help me out!
     
  44. liusuwanxia

    liusuwanxia

    Joined:
    Jul 10, 2017
    Posts:
    3
    I try it and it works, please push a patch in time.
     
    Lanre likes this.
  45. eyecandylab

    eyecandylab

    Joined:
    Jul 24, 2017
    Posts:
    3
    Hi Lanre,

    two things that are problematic in 1.6f1:
    1. Using NatCam.Play() will trigger microphone access. We do not want to use the mic.

    2. The PostProcessBuild always writes a MicrophoneUsageKey into the Info.plist
    We can easily fix 2. by commenting the UNITY_IOS build section, but NatCam is still triggering microphone access, so this would not really help.

    In NatCamiOS.cs there is a configuration setting configuration.recordAudio, but even when this is false, microphone is being accessed. From there it is hard to debug because it is then jumping into the ProAssembly.

    Any insight on this?

    Regards!
     
  46. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,973
    Please email me as I am very curious about this issue.
     
  47. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,973
    This is probably the case (although I don't think it is for the S6 Edge). Put on NatCam's verbose mode, run the application, and check the logs. NatCam will log if it cannot set the focus mode because the camera does not support it.
     
  48. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,973
    Thanks for bringing this to my attention. I have made the change.
     
  49. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,973
    We deprecated that function as it was a add-on from NatCam Extended (which we have deprecated entirely).
     
  50. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,973
    We have changed NatCam to only request microphone access when recording video with microphone audio (when the `recordAudio` flag is set). I am pushing the update today. You can leave the microphone usage key even if you will never ask for the permission; it is innocuous.