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

# XGameStreaming

> XGameStreaming

# XGameStreaming

## 初始化

初始化游戏流式处理功能所需的 API。

| 函数                                                                                                  | 说明                        |
| :-------------------------------------------------------------------------------------------------- | :------------------------ |
| [XGameStreamingInitialize](/reference/system/xgamestreaming/functions/xgamestreaminginitialize)     | 初始化 Game Streaming API。   |
| [XGameStreamingUninitialize](/reference/system/xgamestreaming/functions/xgamestreaminguninitialize) | 取消初始化 Game Streaming API。 |

<a id="ClientProperties" />

## 客户端属性

用于获取流式处理设备或其游戏流属性的 API

### 函数

| 函数                                                                                                                                            | 说明                                                       |
| :-------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------- |
| [XGameStreamingClientPropertiesChangedCallback](/reference/system/xgamestreaming/functions/xgamestreamingclientpropertieschangedcallback)     | 当流式处理设备的属性发生变化时发出通知。                                     |
| [XGameStreamingGetClientIPAddress](/reference/system/xgamestreaming/functions/xgamestreaminggetclientipaddress)                               | **已弃用。** 获取流式处理客户端的 IP 地址。请改用 XSTS 令牌声明。                 |
| [XGameStreamingGetDisplayDetails](/reference/system/xgamestreaming/functions/xgamestreaminggetdisplaydetails)                                 | 获取流式处理客户端的显示详细信息。                                        |
| [XGameStreamingGetSessionId](/reference/system/xgamestreaming/functions/xgamestreaminggetsessionid)                                           | 获取流式处理客户端的会话 ID。                                         |
| [XGameStreamingGetStreamPhysicalDimensions](/reference/system/xgamestreaming/functions/xgamestreaminggetstreamphysicaldimensions)             | 获取视频流当前在流式处理客户端上呈现的物理大小。                                 |
| [XGameStreamingGetTouchBundleVersion](/reference/system/xgamestreaming/functions/xgamestreaminggettouchbundleversion)                         | 获取指定设备上当前使用的触控适配捆绑包的版本。                                  |
| [XGameStreamingGetTouchBundleVersionNameSize](/reference/system/xgamestreaming/functions/xgamestreaminggettouchbundleversionnamesize)         | 获取指定设备上触控适配捆绑包中指定版本名称的大小。                                |
| [XGameStreamingIsTouchInputEnabled](/reference/system/xgamestreaming/functions/xgamestreamingistouchinputenabled)                             | 检查客户端是否会向游戏发送触摸输入。                                       |
| [XGameStreamingRegisterClientPropertiesChanged](/reference/system/xgamestreaming/functions/xgamestreamingregisterclientpropertieschanged)     | 注册一个回调，当任何流式处理客户端设备的属性发生变化时调用该回调。                        |
| [XGameStreamingUnregisterClientPropertiesChanged](/reference/system/xgamestreaming/functions/xgamestreamingunregisterclientpropertieschanged) | 取消注册先前注册的 XGameStreamingClientPropertiesChangedCallback。 |

### 枚举

| 枚举                                                                                                  | 说明                    |
| :-------------------------------------------------------------------------------------------------- | :-------------------- |
| [XGameStreamingClientProperty](/reference/system/xgamestreaming/enums/xgamestreamingclientproperty) | 可以查询的关于客户端流式处理设备的属性。  |
| [XGameStreamingVideoFlags](/reference/system/xgamestreaming/enums/xgamestreamingvideoflags)         | 客户端流式处理设备可能支持的可用视频功能。 |

### 结构

| 结构                                                                                                    | 说明                  |
| :---------------------------------------------------------------------------------------------------- | :------------------ |
| [XGameStreamingDisplayDetails](/reference/system/xgamestreaming/structs/xgamestreamingdisplaydetails) | 有关流式处理客户端设备显示的详细信息。 |

<a id="ConnectionState" />

## 连接状态

管理流式处理客户端设备连接状态所需的 API。

### 函数

| 函数                                                                                                                                          | 说明                                                      |
| :------------------------------------------------------------------------------------------------------------------------------------------ | :------------------------------------------------------ |
| [XGameStreamingConnectionStateChangedCallback](/reference/system/xgamestreaming/functions/xgamestreamingconnectionstatechangedcallback)     | 每当已连接的流式处理客户端的状态发生变化时要调用的回调函数。                          |
| [XGameStreamingGetClientCount](/reference/system/xgamestreaming/functions/xgamestreaminggetclientcount)                                     | 当前连接的流式处理设备的数量。                                         |
| [XGameStreamingGetClients](/reference/system/xgamestreaming/functions/xgamestreaminggetclients)                                             | 获取每个当前已连接客户端的标识符。                                       |
| [XGameStreamingGetConnectionState](/reference/system/xgamestreaming/functions/xgamestreaminggetconnectionstate)                             | 获取指定设备的当前连接状态。                                          |
| [XGameStreamingIsStreaming](/reference/system/xgamestreaming/functions/xgamestreamingisstreaming)                                           | 确定游戏当前是否正在流式处理。                                         |
| [XGameStreamingRegisterConnectionStateChanged](/reference/system/xgamestreaming/functions/xgamestreamingregisterconnectionstatechanged)     | 注册一个回调，当流式处理客户端设备的连接状态发生变化时调用该回调。                       |
| [XGameStreamingUnregisterConnectionStateChanged](/reference/system/xgamestreaming/functions/xgamestreamingunregisterconnectionstatechanged) | 取消注册先前注册的 XGameStreamingConnectionStateChangedCallback。 |

### 枚举

| 枚举                                                                                                    | 说明              |
| :---------------------------------------------------------------------------------------------------- | :-------------- |
| [XGameStreamingConnectionState](/reference/system/xgamestreaming/enums/xgamestreamingconnectionstate) | 流式处理客户端设备的连接状态。 |

<a id="Latency" />

## 延迟

用于针对流式处理延迟调整游戏玩法的 API。

### 函数

| 函数                                                                                                                    | 说明                                  |
| :-------------------------------------------------------------------------------------------------------------------- | :---------------------------------- |
| [XGameStreamingGetStreamAddedLatency](/reference/system/xgamestreaming/functions/xgamestreaminggetstreamaddedlatency) | 获取与流式处理相关的延迟的近期平均值。                 |
| [XGameStreamingGetLastFrameDisplayed](/reference/system/xgamestreaming/functions/xgamestreaminggetlastframedisplayed) | **已弃用。** 获取最近显示在流式处理客户端屏幕上的帧的帧管道令牌。 |
| [XGameStreamingGetAssociatedFrame](/reference/system/xgamestreaming/functions/xgamestreaminggetassociatedframe)       | **已弃用。** 从特定输入读取获取帧管道令牌。            |

## 服务器位置

用于访问游戏流式处理来源的位置的 API。

### 函数

| 函数                                                                                                                            | 说明                   |
| :---------------------------------------------------------------------------------------------------------------------------- | :------------------- |
| [XGameStreamingGetServerLocationName](/reference/system/xgamestreaming/functions/xgamestreaminggetserverlocationname)         | 获取流式处理服务器的数据中心位置。    |
| [XGameStreamingGetServerLocationNameSize](/reference/system/xgamestreaming/functions/xgamestreaminggetserverlocationnamesize) | 获取流式处理服务器数据中心位置的名称大小 |

<a id="TouchAdaptation" />

## 触控适配

用于管理将向相应流式处理客户端公开的触摸控制器布局的 API。

### 函数

| 函数                                                                                                                                                          | 说明                                      |
| :---------------------------------------------------------------------------------------------------------------------------------------------------------- | :-------------------------------------- |
| [XGameStreamingGetGamepadPhysicality](/reference/system/xgamestreaming/functions/xgamestreaminggetgamepadphysicality)                                       | 从特定游戏手柄读取获取输入物理映射。                      |
| [XGameStreamingHideTouchControls](/reference/system/xgamestreaming/functions/xgamestreaminghidetouchcontrols)                                               | 请求所有已连接的流式处理客户端设备在触摸布局可见时将其隐藏。          |
| [XGameStreamingHideTouchControlsOnClient](/reference/system/xgamestreaming/functions/xgamestreaminghidetouchcontrolsonclient)                               | 请求指定的流式处理客户端设备在触摸布局可见时将其隐藏。             |
| [XGameStreamingShowTouchControlLayout](/reference/system/xgamestreaming/functions/xgamestreamingshowtouchcontrollayout)                                     | 请求所有已连接的流式处理客户端设备显示指定的触摸布局。             |
| [XGameStreamingShowTouchControlLayoutOnClient](/reference/system/xgamestreaming/functions/xgamestreamingshowtouchcontrollayoutonclient)                     | 请求指定的已连接流式处理客户端设备显示指定的触摸布局。             |
| [XGameStreamingShowTouchControlsWithStateUpdate](/reference/system/xgamestreaming/functions/xgamestreamingshowtouchcontrolswithstateupdate)                 | 请求所有已连接的流式处理客户端设备更新其触摸控件状态，然后显示指定的触摸布局。 |
| [XGameStreamingShowTouchControlsWithStateUpdateOnClient](/reference/system/xgamestreaming/functions/xgamestreamingshowtouchcontrolswithstateupdateonclient) | 请求指定的流式处理客户端设备更新其触摸控件状态，然后显示指定的触摸布局。    |
| [XGameStreamingUpdateTouchControlsState](/reference/system/xgamestreaming/functions/xgamestreamingupdatetouchcontrolsstate)                                 | 更新所有已连接流式处理客户端设备上的触摸控件状态。               |
| [XGameStreamingUpdateTouchControlsStateOnClient](/reference/system/xgamestreaming/functions/xgamestreamingupdatetouchcontrolsstateonclient)                 | 更新指定流式处理客户端设备上的触摸控件状态。                  |

### 枚举

| 枚举                                                                                                                                    | 说明                                                                   |
| :------------------------------------------------------------------------------------------------------------------------------------ | :------------------------------------------------------------------- |
| [XGameStreamingGamepadPhysicality](/reference/system/xgamestreaming/enums/xgamestreaminggamepadphysicality)                           | 标准 XBOX 无线控制器上所有按钮、摇杆和扳机键的物理映射。对于任何给定的按钮/摇杆/扳机键，物理性可以是未知、物理、虚拟或两者兼具。 |
| [XGameStreamingTouchControlsStateOperationKind](/reference/system/xgamestreaming/enums/xgamestreamingtouchcontrolsstateoperationkind) | 更新触摸控件布局状态时可以采取的操作。                                                  |
| [XGameStreamingTouchControlsStateValueKind](/reference/system/xgamestreaming/enums/xgamestreamingtouchcontrolsstatevaluekind)         | 指定与触摸布局关联的状态的类型。                                                     |

### 结构

| 结构                                                                                                                              | 说明                  |
| :------------------------------------------------------------------------------------------------------------------------------ | :------------------ |
| [XGameStreamingTouchControlsStateOperation](/reference/system/xgamestreaming/structs/xgamestreamingtouchcontrolsstateoperation) | 指定要应用的操作、特定变量的路径和值。 |
| [XGameStreamingTouchControlsStateValue](/reference/system/xgamestreaming/structs/xgamestreamingtouchcontrolsstatevalue)         | 提供触摸控件状态的特定元素的类型和值。 |

## 分辨率

用于管理流分辨率的 API。

### 函数

| 函数                                                                                                    | 说明         |
| :---------------------------------------------------------------------------------------------------- | :--------- |
| [XGameStreamingSetResolution](/reference/system/xgamestreaming/functions/xgamestreamingsetresolution) | 设置视频流的分辨率。 |

## 错误代码

XGameStreaming API 可能返回以下错误代码。有关完整列表，请参阅[错误代码](/reference/errorcodes)。

| 代码                                           | 值          | 说明                                                                                                                                        |
| -------------------------------------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| E\_GAMESTREAMING\_NOT\_INITIALIZED           | 0x89245400 | XGameStreaming 运行时未初始化。在调用其他 API 之前，请先调用 [XGameStreamingInitialize](/reference/system/xgamestreaming/functions/xgamestreaminginitialize)。 |
| E\_GAMESTREAMING\_CLIENT\_NOT\_CONNECTED     | 0x89245401 | 指定的客户端未连接。                                                                                                                                |
| E\_GAMESTREAMING\_NO\_DATA                   | 0x89245402 | 请求的数据不可用。数据可能稍后可用。                                                                                                                        |
| E\_GAMESTREAMING\_NO\_DATACENTER             | 0x89245403 | 当前计算机未在数据中心运行。                                                                                                                            |
| E\_GAMESTREAMING\_NOT\_STREAMING\_CONTROLLER | 0x89245404 | 当前读取不是来自流式处理控制器。                                                                                                                          |

## 概念文档

* [支持云的 API 调用](/build/core-features/common/game-streaming/game-streaming-am-i-streaming)
* [触摸入门](/build/core-features/common/game-streaming/game-streaming-getting-started-with-touch)
* [游戏流式处理延迟补偿深度探究](/build/core-features/common/game-streaming/game-streaming-latency-compensation-deep-dive)
* [游戏流式处理延迟补偿概述](/build/core-features/common/game-streaming/game-streaming-latency-compensation-overview)
* [游戏流式处理延迟测量](/build/core-features/common/game-streaming/game-streaming-latency-measurement)

## 另请参阅

[系统 API 参考](/reference/system/gc-reference-system-toc)


## Related topics

- [XGameStreamingIsStreaming](/zh-CN/reference/system/xgamestreaming/functions/xgamestreamingisstreaming.md)
- [XGameStreamingInitialize](/zh-CN/reference/system/xgamestreaming/functions/xgamestreaminginitialize.md)
- [XGameStreamingUninitialize](/zh-CN/reference/system/xgamestreaming/functions/xgamestreaminguninitialize.md)
- [XGameStreamingGetClients](/zh-CN/reference/system/xgamestreaming/functions/xgamestreaminggetclients.md)
- [XGameStreamingClientProperty](/zh-CN/reference/system/xgamestreaming/enums/xgamestreamingclientproperty.md)
