> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# XAppCaptureStartUserRecord

> XAppCaptureStartUserRecord

# XAppCaptureStartUserRecord

Record as if the user had triggered it. If the player suspends/constrains their game while a recording is ongoing, the recording will be stopped. The recording is saved in the user partition. Capture settings are based on GameDVR settings. Once the concurrent recording limit has been hit, [XAppCaptureStopUserRecord](/reference/system/xappcapture/functions/xappcapturestopuserrecord) or [XAppCaptureCancelUserRecord](/reference/system/xappcapture/functions/xappcapturecanceluserrecord) will need to be called before another recording can be started. Windows support for this API will be added in a future release.

## Syntax

```cpp theme={null}
HRESULT XAppCaptureStartUserRecord(
    XUserHandle requestingUser,
    uint32_t localIdBufferLength,
    char* localIdBuffer
)
```

### Parameters

*requestingUser* \_In\_\
Type: XUserHandle

Handle representing the user requesting the recording.

*localIdBufferLength* \_In\_\
Type: uint32\_t

The length of the buffer receiving the local recording ID.

*localIdBuffer* \_Out\_\
Type: char\*

Buffer containing the local ID specifying the ongoing recording operation.

### Return value

Type: HRESULT

Function result. See [XAppCapture Error Codes](/reference/system/xappcapture/xappcapture_errors) for non-`S_OK` return values.

## Remarks

On successful function completion, localIdOfUserRecording contains the local ID of the recording and must be stored to stop a specific recording with [XAppCaptureStopUserRecord](/reference/system/xappcapture/functions/xappcapturestopuserrecord) or [XAppCaptureCancelUserRecord](/reference/system/xappcapture/functions/xappcapturecanceluserrecord).

<Note>Older clips will be deleted when allotted space is filled to make room for new clips. Use [PLS](/reference/system/xpersistentlocalstorage/xpersistentlocalstorage_members) (Persistent Local Storage), connected storage (e.g. [XGameSave](/reference/system/xgamesave/xgamesave_members) or [XGameSaveFiles](/reference/system/xgamesavefiles/xgamesavefiles_members)), or a similar storage system in order to retain clips for a set period of time.</Note>

```cpp theme={null}
char localIdOfUserRecording[APPCAPTURE_MAX_LOCALID_LENGTH] = { '\0' };

XAppCaptureVideoCaptureSettings captureSettings = { 0 };
if (FAILED_LOG(XAppCaptureGetVideoCaptureSettings(&captureSettings)))
{
    return;
}

if (captureSettings.isCaptureByGamesAllowed)
{
    auto asyncBlock = std::make_unique<XAsyncBlock>();
    ZeroMemory(asyncBlock.get(), sizeof(*asyncBlock));
    asyncBlock->queue = g_taskQueue;
    asyncBlock->callback = [](XAsyncBlock* ab)
    {
        auto asyncBlock = std::unique_ptr<XAsyncBlock>(ab);

        XUserHandle user = nullptr;
        auto scopeExit = wil::scope_exit([&]()
        {
            if (user != nullptr)
            {
                XUserCloseHandle(user);
            }
        });

        if (FAILED_LOG(XUserAddResult(asyncBlock.get(), &user)))
        {
            return;
        }

        if (FAILED_LOG(XAppCaptureStartUserRecord(user, ARRAYSIZE(localIdOfUserRecording), localIdOfUserRecording)))
        {
            return;
        }
        appLog.AddLog("Recording started: localId = %s\n", localIdOfUserRecording);
    };

    if (SUCCEEDED_LOG(XUserAddAsync(
        XUserAddOptions::AddDefaultUserAllowingUI,
        asyncBlock.get())))
    {
        // Once started, release the pointer
        asyncBlock.release();
    }
}
```

## Requirements

**Header:** XAppCapture.h

**Library:** xgameruntime.lib

**Supported platforms:** XBOX One family consoles and XBOX Series consoles

## See also

[XAppCapture members](/reference/system/xappcapture/xappcapture_members)


## Related topics

- [XAppCaptureCancelUserRecord](/reference/system/xappcapture/functions/xappcapturecanceluserrecord.md)
- [XAppCaptureStopUserRecord](/reference/system/xappcapture/functions/xappcapturestopuserrecord.md)
- [XAppCaptureUserRecordingResult](/reference/system/xappcapture/structs/xappcaptureuserrecordingresult.md)
- [XAppCapture](/reference/system/xappcapture/xappcapture_members.md)
- [XAppCaptureRecordTimespan](/reference/system/xappcapture/functions/xappcapturerecordtimespan.md)
