> ## 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.

# XAppCaptureRecordDiagnosticClip

> XAppCaptureRecordDiagnosticClip

# XAppCaptureRecordDiagnosticClip

Records a diagnostic clip from your app.

## Syntax

```cpp theme={null}
HRESULT XAppCaptureRecordDiagnosticClip(  
         time_t startTime,  
         uint32_t durationInMs,  
         const char* filenamePrefix,  
         XAppCaptureRecordClipResult* result  
)  
```

### Parameters

*startTime*   \_In\_\
Type: time\_t

Timestamp for the beginning of the diagnostic clip.

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

Duration in milliseconds of the diagnostic clip.

*filenamePrefix*   \_In\_opt\_\
Type: char\*

Desired prefix for the file name, is optional, will be appended to the front of the diagnostic file name.

*result*   \_Out\_\
Type: [XAppCaptureRecordClipResult\*](/reference/system/xappcapture/structs/xappcapturerecordclipresult)

The resulting recorded diagnostic clip.

### Return value

Type: HRESULT

Function result.

## Remarks

<Note>This function isn't safe to call on a time-sensitive thread. For more information, see [Time-sensitive threads](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads).</Note>

Calling this function does not trigger a UI notification. Clips are saved to a game accessible partition. The [XAppCaptureRecordDiagnosticClipResult](/reference/system/xappcapture/structs/xappcapturerecordclipresult) contains a file path which you can use to access the clip.
On XBOX, this function will only be available on development kits. On retail kits this api will return an error immediately.

On PC, you must enable background recording for your app for this function to work. The best way to do this is to bring up Game Bar by pressing Win+G, then click the Settings icon, go to the Capturing tab, and enable "Record in the background while I'm playing a game".
Then, you must mark your app as a game. The best way to do this is by running your game first. While the game is in focus, bring up Game Bar by pressing Win+G, then click the Settings icon, go to the General tab, and check "Remember this is a game".

## Requirements

**Header:** XAppCapture.h

**Library:** xgameruntime.lib

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

## Conceptual documentation

* [Time-sensitive threads](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads)

## See also

[GameDVR Overview](/build/console-features/game-dvr/gamedvr-broadcast)\
[XAppCapture Members](/reference/system/xappcapture/xappcapture_members)\
[XAppCaptureRecordDiagnosticClipResult](/reference/system/xappcapture/structs/xappcapturerecordclipresult)


## Related topics

- [XAppCaptureRecordClipResult](/reference/system/xappcapture/structs/xappcapturerecordclipresult.md)
- [XAppCapture](/reference/system/xappcapture/xappcapture_members.md)
- [Unity C# API wrappers for the GDK](/build/gdk-and-engines/unity/unity-api-wrappers.md)
- [XAppCaptureRecordTimespan](/reference/system/xappcapture/functions/xappcapturerecordtimespan.md)
- [XAppCaptureStartUserRecord](/reference/system/xappcapture/functions/xappcapturestartuserrecord.md)
