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

# XGameStreaming（API 内容）

> XGameStreaming

# XGameStreaming

## 初始化

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

| 函数 | 说明 |
| :- | :- |
| [XGameStreamingInitialize](https://docs.xbox.com/zh-CN/reference/system/xgamestreaming/functions/xgamestreaminginitialize.md) | 初始化 Game Streaming API。 |
| [XGameStreamingUninitialize](https://docs.xbox.com/zh-CN/reference/system/xgamestreaming/functions/xgamestreaminguninitialize.md) | 取消初始化 Game Streaming API。 |

## 客户端属性

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

### 函数

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

### 枚举

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

### 结构

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

## 连接状态

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

### 函数

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

### 枚举

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

## 延迟

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

### 函数

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

## 服务器位置

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

### 函数

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

## 触控适配

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

### 函数

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

### 枚举

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

### 结构

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

## 分辨率

用于管理流分辨率的 API。

### 函数

| 函数 | 说明 |
| :- | :- |
| [XGameStreamingSetResolution](https://docs.xbox.com/zh-CN/reference/system/xgamestreaming/functions/xgamestreamingsetresolution.md) | 设置视频流的分辨率。 |

## 错误代码

XGameStreaming API 可能返回以下错误代码。有关完整列表，请参阅[错误代码](https://docs.xbox.com/zh-CN/reference/errorcodes.md)。

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

## 概念文档

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

## 另请参阅

[系统 API 参考](https://docs.xbox.com/zh-CN/reference/system/gc-reference-system-toc.md)


## Related topics

- [云感知 API 调用](https://docs.xbox.com/zh-CN/build/core-features/common/game-streaming/game-streaming-am-i-streaming.md)
- [触控入门](https://docs.xbox.com/zh-CN/build/core-features/common/game-streaming/game-streaming-getting-started-with-touch.md)
- [游戏串流延迟测量](https://docs.xbox.com/zh-CN/build/core-features/common/game-streaming/game-streaming-latency-measurement.md)
- [游戏串流延迟补偿概述](https://docs.xbox.com/zh-CN/build/core-features/common/game-streaming/game-streaming-latency-compensation-overview.md)
- [游戏串流延迟补偿深入探讨](https://docs.xbox.com/zh-CN/build/core-features/common/game-streaming/game-streaming-latency-compensation-deep-dive.md)
