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

# XGameStreamingGetStreamPhysicalDimensions

> XGameStreamingGetStreamPhysicalDimensions

# XGameStreamingGetStreamPhysicalDimensions

Get the physical dimensions of the video stream as it renders on the streaming client.

<a id="syntaxSection" />

## Syntax

```cpp theme={null}
HRESULT XGameStreamingGetStreamPhysicalDimensions(
         XGameStreamingClientId client,
         uint32_t* horizontalMm,
         uint32_t* verticalMm
)
```

<a id="parametersSection" />

### Parameters

*client*   \_In\_\
Type: XGameStreamingClientId

The client to query the physical size of.

*horizontalMm*   \_Out\_\
Type: uint32\_t\*

The size in millimeters of the horizontal axis of the video stream.

*verticalMm*   \_Out\_\
Type: uint32\_t\*

The size in millimeters of the vertical axis of the video stream.

<a id="retvalSection" />

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

For a list of error codes, see [Error Codes](/reference/errorcodes).

<a id="remarksSection" />

## Remarks

You can use this method to determine whether the stream will be sent to a smaller device (for example, a smartphone).

This allows you to present a more player friendly, device–appropriate experience (for example, by using a larger font size) based on the device size.

If you want the game to respond to changes in the physical dimensions of the stream, then you should register a callback via [XGameStreamingRegisterClientPropertiesChanged](/reference/system/xgamestreaming/functions/xgamestreamingregisterclientpropertieschanged).

<a id="exampleSection" />

## Example

The following code example demonstrates how to use the `XGameStreamingGetStreamPhysicalDimensions` function to find the smallest dimensions for a streaming client.

```cpp theme={null}
void GetSmallestStreamingClient(uint32_t& widthMm, uint32_t& heightMm)
    {
        // If we don't know what the smallest client is, then search through them to find it
        if (m_smallestClient == XGameStreamingNullClientId)
        {
            for (const auto client : m_streamingClients)
            {
                if (client.clientId != XGameStreamingNullClientId)
                {
                    uint32_t clientWidthMm = 0;
                    uint32_t clientHeightMm = 0;
                    if (SUCCEEDED(XGameStreamingGetStreamPhysicalDimensions(client.clientId, &clientWidthMm, &clientHeightMm)))
                    {
                        if (clientWidthMm < m_smallestClientWidthMm)
                        {
                            m_smallestClientWidthMm = clientWidthMm;
                            m_smallestClientHeightMm = clientHeightMm;
                        }
                    }
                }
            }
        }

        widthMm = m_smallestClientWidthMm;
        heightMm = m_smallestClientHeightMm;
    }
```

<a id="requirementsSection" />

## Requirements

**Header:** xgamestreaming.h

**Library:** xgameruntimelib

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

<a id="seealsoSection" />

## See also

[XGameStreaming](/reference/system/xgamestreaming/xgamestreaming_members)\
[XGameStreamingRegisterClientPropertiesChanged](/reference/system/xgamestreaming/functions/xgamestreamingregisterclientpropertieschanged)\
[XGameStreaming](/reference/system/xgamestreaming/xgamestreaming_members#ClientProperties)


## Related topics

- [XGameStreamingClientProperty](/reference/system/xgamestreaming/enums/xgamestreamingclientproperty.md)
- [Optimizing your game for XBOX Game Streaming](/build/core-features/common/game-streaming/game-streaming-optimizing-your-game.md)
- [XGameStreaming](/reference/system/xgamestreaming/xgamestreaming_members.md)
- [XAG 101: Text display](/build/game-principles/accessibility/xag-deep-dives/xag-101-text-display.md)
- [XGameStreamingGetStreamAddedLatency](/reference/system/xgamestreaming/functions/xgamestreaminggetstreamaddedlatency.md)
