# ARRecordingManager

Provides access to session recording functionality.

## Summary

### Inheritance

Inherits from: [`UnityEngine::MonoBehaviour`](https://docs.unity3d.com/ScriptReference/MonoBehaviour.html)

| ### Properties ||
|---|---|
| `https://developers.google.com/ar/reference/unity-arf/class/Google/XR/ARCoreExtensions/ARRecordingManager#recordingstatus` | `https://developers.google.com/ar/reference/unity-arf/namespace/Google/XR/ARCoreExtensions#recordingstatus` Gets the current state of the recorder. |

| ### Public functions ||
|---|---|
| `https://developers.google.com/ar/reference/unity-arf/class/Google/XR/ARCoreExtensions/ARRecordingManager#recordtrackdata(https://docs.microsoft.com/en-us/dotnet/api/System.Guid trackId, byte[] data)` | `https://developers.google.com/ar/reference/unity-arf/namespace/Google/XR/ARCoreExtensions#recordingresult` Writes a data sample in the specified external data track. |
| `https://developers.google.com/ar/reference/unity-arf/class/Google/XR/ARCoreExtensions/ARRecordingManager#startrecording(https://developers.google.com/ar/reference/unity-arf/class/Google/XR/ARCoreExtensions/ARCoreRecordingConfig#classGoogle_1_1XR_1_1ARCoreExtensions_1_1ARCoreRecordingConfig config)` | `https://developers.google.com/ar/reference/unity-arf/namespace/Google/XR/ARCoreExtensions#recordingresult` Starts a new recording, using the provided `https://developers.google.com/ar/reference/unity-arf/class/Google/XR/ARCoreExtensions/ARCoreRecordingConfig#classGoogle_1_1XR_1_1ARCoreExtensions_1_1ARCoreRecordingConfig` to define the location to save the dataset and other options. |
| `https://developers.google.com/ar/reference/unity-arf/class/Google/XR/ARCoreExtensions/ARRecordingManager#stoprecording()` | `https://developers.google.com/ar/reference/unity-arf/namespace/Google/XR/ARCoreExtensions#recordingresult` Stops the current recording. |

## Properties

### RecordingStatus

```c#
RecordingStatus RecordingStatus
```
Gets the current state of the recorder.


| Details ||
|---|---|
| **Returns** | The current `https://developers.google.com/ar/reference/unity-arf/namespace/Google/XR/ARCoreExtensions#recordingstatus`. |

## Public functions

### RecordTrackData

```c#
RecordingResult RecordTrackData(
  Guid trackId,
  byte[] data
)
```
Writes a data sample in the specified external data track.

The external samples recorded using this API will be muxed into the recorded MP4 dataset in a corresponding additional MP4 stream.

For smooth playback of the MP4 on video players and for future compatibility of the MP4 datasets with ARCore's playback of external data tracks it is recommended that the external samples are recorded at a frequency no higher than 90kHz.

Additionally, if the external samples are recorded at a frequency lower than 1Hz, empty padding samples will be automatically recorded at approximately one second intervals to fill in the gaps.

Recording external samples introduces additional CPU and/or I/O overhead and may affect app performance.


Details Parameters `trackId` The unique ID of the track being recorded to. This will be the `TrackData.Id` used to configure the track. `data` The data being recorded at current time. **Returns** `RecordingResult.OK` if the data was recorded successfully, or a different `https://developers.google.com/ar/reference/unity-arf/namespace/Google/XR/ARCoreExtensions#recordingresult` if there was an error.

### StartRecording

```c#
RecordingResult StartRecording(
  ARCoreRecordingConfig config
)
```
Starts a new recording, using the provided `https://developers.google.com/ar/reference/unity-arf/class/Google/XR/ARCoreExtensions/ARCoreRecordingConfig#classGoogle_1_1XR_1_1ARCoreExtensions_1_1ARCoreRecordingConfig` to define the location to save the dataset and other options.

If a recording is already in progress this call will fail. Check `https://developers.google.com/ar/reference/unity-arf/class/Google/XR/ARCoreExtensions/ARRecordingManager#recordingstatus` before making this call. When an ARCore session is paused (unless `https://developers.google.com/ar/reference/unity-arf/class/Google/XR/ARCoreExtensions/ARCoreRecordingConfig#autostoponpause` is enabled), recording may continue. During this time the camera feed will be recorded as a black screen, but sensor data will continue to be captured.

Session recordings may contain sensitive information. See [documentation on Recording and Playback](https://developers.google.com/ar/develop/recording-and-playback#what%E2%80%99s_in_a_recording) to learn which data is saved in a recording.


Details Parameters `config` `https://developers.google.com/ar/reference/unity-arf/class/Google/XR/ARCoreExtensions/ARCoreRecordingConfig#classGoogle_1_1XR_1_1ARCoreExtensions_1_1ARCoreRecordingConfig` containing the path to save the dataset along with other recording options. **Returns** `RecordingResult.OK` if the recording is started (or will start on the next Session resume.) Or a `https://developers.google.com/ar/reference/unity-arf/namespace/Google/XR/ARCoreExtensions#recordingresult` if there was an error.

### StopRecording

```c#
RecordingResult StopRecording()
```
Stops the current recording.

If there is no recording in progress, this method will return `RecordingResult.OK`.


| Details ||
|---|---|
| **Returns** | `RecordingResult.OK` if the recording was stopped successfully, or `RecordingResult.ErrorRecordingFailed` if there was an error. |