# Recording User View While Unity App Accesses Camera

**URL:** <https://forum.magicleap.cloud/t/recording-user-view-while-unity-app-accesses-camera/5738>\
**Category:** Unity Development\
**Tags:** development, unity\
**Created:** [May 20, 2025, 2:59pm UTC](https://forum.magicleap.cloud/t/recording-user-view-while-unity-app-accesses-camera/5738 "2025-05-20T14:59:49Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![luke](https://avatars.discourse-cdn.com/v4/letter/l/7ab992/32.png) [@luke](https://forum.magicleap.cloud/u/luke)\
**Post date:** [May 20, 2025, 2:59pm UTC](https://forum.magicleap.cloud/t/recording-user-view-while-unity-app-accesses-camera/5738/1 "2025-05-20T14:59:49Z")

</div>

Give us as much detail as possible regarding the issue you’re experiencing:

**6000.0.023f1** :  
**1.12.0** :  
**Android 10.0** :  
**Windows** :

I am working on an app for the magic leap 2 headset in Unity that utilizes the onboard camera for image capture. I would like to be able to record the user’s view for demonstration purposes however as you may know, doing so will cut the app’s access to the camera. It has been mentioned in some other threads that you can get around this limitation by separating the camera interfaces. There is very little information on how this is actually done however.  
The thread I am referring to can be seen here:

> [@About Magic Leap 2 Video Recording](https://forum.magicleap.cloud/t/about-magic-leap-2-video-recording/746):
>
> @sengelman I have a question about the Magic Leap 2's photo or video recording capabilities. With Magic Leap 1, it was not possible to take a photo or shoot video while running an application that uses the camera function, such as Image Tracking. I believe this limitation was due to the fact that Magic Leap 1 has only one camera. Can't the Magic Leap 2 also take a picture or shoot a video while using a function that uses the camera within an application as described above? Or is it possible …

The example script for using the ML camera containes the following lines:

```auto
//The identifier can either target the Main or CV cameras.
    private MLCamera.Identifier _identifier = MLCamera.Identifier.Main;

```

To access the CV cameras I swapped out the .Main identifier with .CV. However the issue persists, the app loses access to the camera when I start recording the user view.

Is there something else that must be done to the example camera scripts to get the desired behavior?

Thanks for any and all help.

---

<div class="post-metadata">

**Author:** ![magicbot](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.magicleap.cloud/magicbot/32/2470_2.png) [@magicbot](https://forum.magicleap.cloud/u/magicbot)\
**Post date:** [May 21, 2025, 12:08am UTC](https://forum.magicleap.cloud/t/recording-user-view-while-unity-app-accesses-camera/5738/2 "2025-05-21T00:08:23Z")

</div>

What example camera script are you using? Are you using the one from the Magic Leap 2 Developer portal? Are you using any 3rd party assets? I recommend creating a scene and then using the basic camera example that is on the developer portal, then trying to record after the app starts.

---

<div class="post-metadata">

**Author:** ![luke](https://avatars.discourse-cdn.com/v4/letter/l/7ab992/32.png) [@luke](https://forum.magicleap.cloud/u/luke)\
**Post date:** [May 25, 2025, 5:30pm UTC](https://forum.magicleap.cloud/t/recording-user-view-while-unity-app-accesses-camera/5738/3 "2025-05-25T17:30:20Z")

</div>

I am using the photo capture script from this example post.

> **[MLCamera Examples | MagicLeap Developer Documentation](https://developer-docs.magicleap.cloud/docs/guides/unity/camera/ml-camera-example/)**
>
> This section includes a simple camera example. A detailed explanation of each function can be found in the Camera Overview guide.

The script works fine for capturing images but when I begin recording it logs that it failed to access the camera.

---

<div class="post-metadata">

**Author:** ![magicbot](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.magicleap.cloud/magicbot/32/2470_2.png) [@magicbot](https://forum.magicleap.cloud/u/magicbot)\
**Post date:** [May 27, 2025, 3:00pm UTC](https://forum.magicleap.cloud/t/recording-user-view-while-unity-app-accesses-camera/5738/4 "2025-05-27T15:00:06Z")

</div>

You will need to edit the script on line 16 to change the camera identifier

---

<div class="post-metadata">

**Author:** ![luke](https://avatars.discourse-cdn.com/v4/letter/l/7ab992/32.png) [@luke](https://forum.magicleap.cloud/u/luke)\
**Post date:** [May 30, 2025, 9:01pm UTC](https://forum.magicleap.cloud/t/recording-user-view-while-unity-app-accesses-camera/5738/5 "2025-05-30T21:01:40Z")

</div>

If you look not so closely at my first post you will see that I already attempted this fix, and it did not work.

Can I please have a real solution from an actual developer.

---

<div class="post-metadata">

**Author:** ![magicbot](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.magicleap.cloud/magicbot/32/2470_2.png) [@magicbot](https://forum.magicleap.cloud/u/magicbot)\
**Post date:** [June 2, 2025, 2:55pm UTC](https://forum.magicleap.cloud/t/recording-user-view-while-unity-app-accesses-camera/5738/6 "2025-06-02T14:55:00Z")

</div>

Sorry, I might have misunderstood the issue.

Can you try using this camera capture script instead and verifying that the callback is made by adding a `Debug.Log` in the `OnCaptureRawVideoFrameAvailable(...)` function?

> **[MLCamera Examples | MagicLeap Developer Documentation](https://developer-docs.magicleap.cloud/docs/guides/unity/camera/ml-camera-example/#async-example)**
>
> This section includes a simple camera example. A detailed explanation of each function can be found in the Camera Overview guide.

---

<div class="post-metadata">

**Author:** ![luke](https://avatars.discourse-cdn.com/v4/letter/l/7ab992/32.png) [@luke](https://forum.magicleap.cloud/u/luke)\
**Post date:** [July 22, 2025, 8:33pm UTC](https://forum.magicleap.cloud/t/recording-user-view-while-unity-app-accesses-camera/5738/7 "2025-07-22T20:33:20Z")

</div>

Thank you.  
This solution has worked, I apologize for my frustrations earlier.
