Question Regard to Screen Record

Hello

I'm working on a Unity project using Unity 2022.3.11f1 with Magic Leap SDK 1.5 and Magic Leap API 2.0, and I’d like to know if it's possible to start and stop screen recording programmatically using Unity C# with the MLSDK. I couldn’t find any documentation or examples on this in the Magic Leap user guide, so I’m reaching out to see if this functionality is supported.

If screen recording is possible, could anyone share some example code or a snippet that shows how to:

  1. Request the necessary permissions (such as audio and video recording).
  2. Start and stop the recording.
  3. Save the recorded file to the device’s file system.

Any guidance or resources would be greatly appreciated!

Thanks in advance!

Hello,

You can use the MLCamera apis to access the rgb camera feed with 3d content composited on top of the image in a Unity application.

Here is some information about the apis-

Note that while the MLCamera apis are based on older ML C apis, they can still be used in a Unity project that makes use of the OpenXR plugin provider and you'd find that the MLCamera class is still included in current versions of the ML Unity sdk package.

There is a sample that demonstrates how to use the apis available in older versions of the MagicLeap Unity examples project. The sample is not included in v2.0+ of the MagicLeap Unity examples project as it's focus is now on demonstrating usage of OpenXR apis.

You can still download and build an older version of the examples project from ML Hub if you'd like to try it- v1.12.1 is the last version of the project that would have the sample-

That all said, there's a feature in the ML OS where you can record a video capture from any application by pressing and holding the home button on the controller and then holding the bumper button for two seconds. If you just need to be able to capture and save a video, then I'd recommend giving it a try before implementing your own capture flow. The OS provides some UX out of the box for previewing and saving the video after you've captured it. See this support article for details-

Best,
Adam

1 Like