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

# XGameStreamingGetLastFrameDisplayed

> XGameStreamingGetLastFrameDisplayed

# XGameStreamingGetLastFrameDisplayed

<Info>**Deprecated.** This API is deprecated as of the 2604 GDK release and will be removed in a future GDK release. There's no replacement API: titles should use [XGameStreamingGetStreamAddedLatency](/reference/system/xgamestreaming/functions/xgamestreaminggetstreamaddedlatency) for latency-aware gameplay adjustments instead.</Info>

Gets the frame pipeline token for the frame that was most recently displayed on the streaming client's screen.

## Syntax

```cpp theme={null}
HRESULT XGameStreamingGetLastFrameDisplayed(  
         XGameStreamingClientId client,  
         D3D12XBOX_FRAME_PIPELINE_TOKEN* framePipelineToken  
)  
```

### Parameters

*client*   \_In\_\
Type: XGameStreamingClientId

The ID of the streaming client device that is being queried.

*framePipelineToken*   \_Out\_\
Type: D3D12XBOX\_FRAME\_PIPELINE\_TOKEN\*

The frame pipeline token that was last displayed on the client device.

### Return value

Type: HRESULT

Returns **S\_OK** if successful; otherwise, returns an error code.

#### Potential Errors

| Error Code                               | Error Value | Reason for Error                                                                                                                                                                     |
| ---------------------------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| E\_GAMESTREAMING\_NOT\_INITIALIZED       | 0x89245400  | The XGameStreaming runtime has not been initialized. Call [XGameStreamingInitialize](/reference/system/xgamestreaming/functions/xgamestreaminginitialize) before calling other APIs. |
| E\_GAMESTREAMING\_CLIENT\_NOT\_CONNECTED | 0x89245401  | The specified client is not connected.                                                                                                                                               |
| E\_GAMESTREAMING\_NO\_DATA               | 0x89245402  | The requested data is not available. The data may be available later.                                                                                                                |

## Remarks

When a player is streaming a game, `XGameStreamingGetLastFrameDisplayed` can be utilized if the game needs to change game behavior upon confirmation that a particular frame was displayed on the user's screen.

Some examples of when a game may utilize this include:

* A visual timer has expired and the player took no action before the expiration.
* An action was not taken within the appropriate window.
* A player continued their motion out of bounds and did not take action to recover.

`XGameStreamingGetLastFrameDisplayed` should be used when trying to determine when an action should have been taken, but wasn't.  In the case where the game needs to determine what was being displayed when an input **was** done by the player, the game should utilize [XGameStreamingGetAssociatedFrame](/reference/system/xgamestreaming/functions/xgamestreaminggetassociatedframe).

## Example

```C++ theme={null}
// In this example, when processing input, the game would like to pass along the last frame 
// that was being displayed to the player so that their simulation engine can take that into account.
 

// The framePipelineToken was initially captured at the callback of WaitFrameEventX

void Game::Update(DX::StepTimer const& timer)
{
    ...

    D3D12XBOX_FRAME_PIPELINE_TOKEN framePipelineToken = D3D12XBOX_FRAME_PIPELINE_TOKEN_NULL;
    if SUCCEEDED(XGameStreamingGetLastFrameDisplayed(clientId, &framePipelineToken)
    {
        SimulateBasedOnLastFrameDisplayed(framePipelineToken);
    }
    else 
    {
        // don't have last token, potentially simulate based on current frame

        SimulateBasedOnCurrentFrame();
    }

    
      
    ...
}

```

## Requirements

**Header:** xgamestreaming.h

**Library:** xgameruntime.lib

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

## Conceptual documentation

* [Game streaming latency compensation deep dive](/build/core-features/common/game-streaming/game-streaming-latency-compensation-deep-dive)

## See also

[XGameStreamingGetAssociatedFrame](/reference/system/xgamestreaming/functions/xgamestreaminggetassociatedframe)\
[XGameStreaming](/reference/system/xgamestreaming/xgamestreaming_members#Latency)\
[Game Streaming Latency Compensation Overview](/build/core-features/common/game-streaming/game-streaming-latency-compensation-overview)


## Related topics

- [XGameStreamingGetAssociatedFrame](/reference/system/xgamestreaming/functions/xgamestreaminggetassociatedframe.md)
- [XGameStreaming](/reference/system/xgamestreaming/xgamestreaming_members.md)
- [Game streaming latency compensation deep dive](/build/core-features/common/game-streaming/game-streaming-latency-compensation-deep-dive.md)
- [XGameStreamingHideTouchControls](/reference/system/xgamestreaming/functions/xgamestreaminghidetouchcontrols.md)
- [XGameStreamingHideTouchControlsOnClient](/reference/system/xgamestreaming/functions/xgamestreaminghidetouchcontrolsonclient.md)
