> For the complete documentation index, see [llms.txt](https://docs.ggwp.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ggwp.com/chinese-simplified/ggwp-ke-hu-duan-sdk/qi-ta-zhi-chi-de-ji-cheng/yu-yin-vivox/yu-unity-ssr-ji-cheng.md).

# 与 Unity SSR 集成

## 概述

请 [请参阅此处](/chinese-simplified/ggwp-ke-hu-duan-sdk/qi-ta-zhi-chi-de-ji-cheng/yu-yin-vivox/vivoxunity-ssr-yu-ggwp-sdk.md) 了解 Unity SSR + GGWP 的通用集成流程。

以下是 Unity 文档中与 SSR 相关的几个链接：

* [服务器端录制](https://docs.unity.com/ugs/en-us/manual/vivox-unity/manual/Unity/server-side-recording/ssr-overview)
* [开发者文档](https://docs.vivox.com/v5/general/core/5_19_0/en-us/Default.htm#Core/developer-guide/server-side-recording/ssr-overview.htm)
* [Unity Services Web API 文档](https://services.docs.unity.com/ssr/v2/)

## API 要求

Vivox 录制必须通过 SSR API 调用触发。这可以在游戏语音会话期间按固定频率执行，也可以在比赛结束等事件发生时执行。针对你的审核目标，请联系你的 Vivox  წარმომადგენ代表，以便帮助设置正确的 SSR 触发策略。

调用 SSR API 需要以下输入：

<table><thead><tr><th width="122.23828125">凭证</th><th>来源</th><th>用途</th></tr></thead><tbody><tr><td>组织 ID</td><td>Unity 控制台 → Vivox → 配置页面</td><td>与你的游戏关联的组织 ID</td></tr><tr><td>项目 ID</td><td>同上。</td><td>分配给你的游戏的项目 ID</td></tr><tr><td>访问令牌</td><td>同上。</td><td>用于签名 JWT 的共享密钥</td></tr><tr><td>频道会话 ID</td><td>当用户加入频道时在运行时获取此值</td><td>用于指定要录制的特定会话</td></tr><tr><td>AWS 访问密钥</td><td>由 GGWP 提供</td><td>用于访问 S3 存储桶进行存储</td></tr><tr><td>AWS 密钥</td><td>由 GGWP 提供</td><td>用于访问 S3 存储桶进行存储</td></tr><tr><td>S3 存储桶名称</td><td>由 GGWP 提供</td><td>用于存储语音录音</td></tr></tbody></table>

## 触发 SSR 的示例脚本

此脚本会触发最近 15 分钟语音数据的录制。

```python
import requests

ORG_ID = "UNITY_ORG_ID"
PROJECT_ID = "UNITY_PROJECT_ID"
ACCESS_TOKEN = "UNITY_ACCESS_TOKEN"
CHANNEL_SESSION_ID = "UNITY_SOMETHING_LIKE_sip:confctl-g-xxxx@mtu1xp.vivox.com"
ACCESS_KEY_ID = "GGWP_AWS_KEY"
SECRET_KEY = "GGWP_AWS_SECRET"

# AWS S3 设置
S3_BUCKET = "GGWP_BUCKET"

url = f"https://vivox.services.api.unity.com/ssr/v2/organizations/{ORG_ID}/projects/{PROJECT_ID}/monitor"

headers = {
    "Authorization": f"Basic {ACCESS_TOKEN}",
    "Content-Type": "application/json"
}

payload = {
  "targetUri": CHANNEL_SESSION_ID,
  "history": 15,
  "callbackUrl": "https://something.somthing",
  "callbackKey": "test-123",
  "storageOptions": {
    "provider": "aws",
    "credentials": {
      "bucket": S3_BUCKET,
      "accessKeyId": ACCESS_KEY_ID,
      "secretAccessKey": SECRET_KEY
    }
  }
}

response = requests.post(url, json=payload, headers=headers)

if response.status_code == 202:
    print("✅ SSR 已成功启动。")
    print(response.json())
else:
    print(f"❌ 启动 SSR 失败：{response.status_code}")
    print(response.text)
```
