# DepthCamera Operating mode SR+LR can not be set

**URL:** <https://forum.magicleap.cloud/t/depthcamera-operating-mode-sr-lr-can-not-be-set/3248>\
**Category:** Unity Development\
**Tags:** depth-camera\
**Created:** [March 4, 2024, 1:35pm UTC](https://forum.magicleap.cloud/t/depthcamera-operating-mode-sr-lr-can-not-be-set/3248 "2024-03-04T13:35:39Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![kocsisa](https://avatars.discourse-cdn.com/v4/letter/k/ccd318/32.png) [@kocsisa](https://forum.magicleap.cloud/u/kocsisa)\
**Post date:** [March 4, 2024, 1:35pm UTC](https://forum.magicleap.cloud/t/depthcamera-operating-mode-sr-lr-can-not-be-set/3248/1 "2024-03-04T13:35:39Z")

</div>

**Unity Editor version** : 2022.3.11f1  
**ML2 OS version** : Version 1.5.0  
**Unity SDK version** : 2.0.0  
**Host OS** : (Windows/MacOS): Windows 11 Pro 23H2 22631.3235

On the [Sensors | MagicLeap Developer Documentation](https://developer-docs.magicleap.cloud/docs/device/hardware/sensors/#depth-camera) page it is said that:

- Operating Modes - SR (60Hz), LR (5Hz), SR+LR (5Hz), SR(~50+Hz) + LR(1Hz)

When trying to get SR+LR Stream e.g. as

```
    Streams = MLDepthCamera.Stream.LongRange | MLDepthCamera.Stream.ShortRange,

```

than it leads to getting a runtime error:

```
    Error: MLDepthCameraConnect in the Magic Leap API failed. Reason: MLResult_InvalidParam 
    UnityEngine.XR.MagicLeap.MLResult:DidNativeCallSucceed(Code, String, Predicate`1, Boolean)
    UnityEngine.XR.MagicLeap.MLDepthCamera:InternalConnect(Settings)"

```

Which is not a suprise as the enum has no [Flags] attribute.

I Create the DepthCamera by teh next code:

```
    private bool CreateDepthCamera()
    {
        uint longRange = (uint)MLDepthCamera.FrameType.LongRange;
        uint shortRange = (uint)MLDepthCamera.FrameType.ShortRange;
        MLDepthCamera.StreamConfig[] config = new MLDepthCamera.StreamConfig[Math.Max(longRange, shortRange) + 1];

        config[longRange].Flags = (uint)depthCamCaptureFlags;
        config[longRange].Exposure = 1600;
        config[longRange].FrameRateConfig = depthLongRangeFPS;

        config[shortRange].Flags = (uint)depthCamCaptureFlags;
        config[shortRange].Exposure = 375;
        config[shortRange].FrameRateConfig = depthShortRangeFPS;

        depthSettings = new MLDepthCamera.Settings()
        {
            //Streams = MLDepthCamera.Stream.LongRange | MLDepthCamera.Stream.ShortRange, // leads to: Failed to connect to depth camera: InvalidParam. Stream Enum is not defined as [Flags] !
            Streams = depthStream,
            StreamConfig = config
        };

        MLDepthCamera.SetSettings(depthSettings);

```

* * *

If I set only SR or LR, than I change the Setting by calling

```
MLDepthCamera.UpdateSettings(depthSettings);

```

then switching between ShortRange / LongRange and getting next depth frame takes more than 2700 ms.

**My Question is** : How can I successfully get a SR+LR (5Hz) and SR(~50+Hz) + LR(1Hz) as it is written in the documentation?

---

<div class="post-metadata">

**Author:** ![etucker](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.magicleap.cloud/etucker/32/842_2.png) [@etucker](https://forum.magicleap.cloud/u/etucker)\
**Post date:** [March 5, 2024, 8:55pm UTC](https://forum.magicleap.cloud/t/depthcamera-operating-mode-sr-lr-can-not-be-set/3248/2 "2024-03-05T20:55:34Z")

</div>

Hi @kocsisa,

Thank you for reaching out regarding this question. I have consulted our team and I will report back as soon as I learn more.

Best,

El

---

<div class="post-metadata">

**Author:** ![etucker](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.magicleap.cloud/etucker/32/842_2.png) [@etucker](https://forum.magicleap.cloud/u/etucker)\
**Post date:** [March 6, 2024, 8:59pm UTC](https://forum.magicleap.cloud/t/depthcamera-operating-mode-sr-lr-can-not-be-set/3248/3 "2024-03-06T20:59:07Z")

</div>

> [@kocsisa](#):
>
> **My Question is** : How can I successfully get a SR+LR (5Hz) and SR(~50+Hz) + LR(1Hz) as it is written in the documentation?

Hi @kocsisa,

Thank you for reaching out about this. This information on the forum is inaccurate and we will update it as soon as possible. Apologies.

We support the following: SR @ 5 Hz, SR @ 25/50 (50 Hz PLC), SR @ 30/60 Hz (60 Hz PLC), LR @ 1/5 Hz.

At this time, we do not support a mixed SR + LR mode.

Best,

El

---

<div class="post-metadata">

**Author:** ![kocsisa](https://avatars.discourse-cdn.com/v4/letter/k/ccd318/32.png) [@kocsisa](https://forum.magicleap.cloud/u/kocsisa)\
**Post date:** [March 8, 2024, 6:42am UTC](https://forum.magicleap.cloud/t/depthcamera-operating-mode-sr-lr-can-not-be-set/3248/4 "2024-03-08T06:42:01Z")

</div>

Hi @etucker,

It really a bad news for us.

What about the switching time between SR/LR modes? Can we somehow reduce it from the actual 2700 ms?

> [@kocsisa](#):
>
> switching between ShortRange / LongRange and getting next depth frame takes more than 2700 ms.

---

<div class="post-metadata">

**Author:** ![etucker](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.magicleap.cloud/etucker/32/842_2.png) [@etucker](https://forum.magicleap.cloud/u/etucker)\
**Post date:** [March 13, 2024, 12:11am UTC](https://forum.magicleap.cloud/t/depthcamera-operating-mode-sr-lr-can-not-be-set/3248/5 "2024-03-13T00:11:33Z")

</div>

> [@kocsisa](#):
>
> What about the switching time between SR/LR modes? Can we somehow reduce it from the actual 2700 ms?

What is your general use case for this? We would like to help you find a solution to keep you moving forward.

Best,

El

---

<div class="post-metadata">

**Author:** ![kocsisa](https://avatars.discourse-cdn.com/v4/letter/k/ccd318/32.png) [@kocsisa](https://forum.magicleap.cloud/u/kocsisa)\
**Post date:** [March 13, 2024, 6:56am UTC](https://forum.magicleap.cloud/t/depthcamera-operating-mode-sr-lr-can-not-be-set/3248/6 "2024-03-13T06:56:35Z")

</div>

Thank you for sharing this with us.

We are creating a feedback ticket for this issue and hope to provide a workaround soon. Thank you for your patience.

Best,

El
