> For the complete documentation index, see [llms.txt](https://docs.decentraland.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.decentraland.org/creator/content-creator-zh/chang-jing-bian-ji-qi/shi-shi-yun-ying/live-streaming.md). Agents can also search and read this documentation through its [MCP server](https://docs.decentraland.org/~gitbook/mcp).

# 直播

使用 Video Screen 和 Admin Tools 将实时视频流传输到场景中。

将 **Video Screen** 智能道具与 **Admin Tools** 智能道具搭配使用，即可将实时视频流传输到场景中。

Decentraland 提供多种将实时视频流传输到场景中的方式：

* **DCL Cast** *（简易模式）*：使用 Decentraland 的免费流媒体网页应用，轻松与场景中的其他玩家共享摄像头或屏幕，无需设置流媒体软件。此模式延迟最低，设置也最简单。
* **Stream** *（高级模式）*：使用 [OBS](https://obsproject.com/) 等流媒体软件，通过 Decentraland 的流媒体基础设施进行直播。此模式让你能够更灵活地控制直播内容，例如屏幕布局和音频来源。
* **Video URL** *（高级模式）*：将 URL 粘贴到 **Video URL** 字段中，即可指向你自己的流媒体基础设施。

<img src="https://2460066822-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoPnXBby9S6MrsW83Y9qZ%2Fuploads%2Fgit-blob-907ab22dabdf237cede26b32efa703534a8d0192%2Fstreaming-modes.webp?alt=media" alt="直播方式" width="400">

在 Worlds 和 Genesis City 中均可直播，场景端没有观众人数限制。

## 配置场景

以下步骤适用于 DCL Cast 和 Stream 两种方式：

1. 向场景中添加一个 **Video Screen** 智能道具。

   ![](https://2460066822-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoPnXBby9S6MrsW83Y9qZ%2Fuploads%2Fgit-blob-4ffd58cadcc524a13cd567ca4d5ccdc70fc994f2%2Fvideo-player-item.webp?alt=media)
2. 添加一个 **Admin Tools** 智能道具，并启用 **Video Screens** 部分。从下拉菜单中选择每个屏幕，并为其设置一个便于识别的名称，以供管理界面使用。

   ![](https://2460066822-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoPnXBby9S6MrsW83Y9qZ%2Fuploads%2Fgit-blob-b2e6cf481ed7850bb28891a799dff08cb62c39e4%2Fmulti-video-setup.webp?alt=media)
3. 发布场景（World 或 Genesis City），然后以具有管理员权限的用户身份进入。

   ![](https://2460066822-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoPnXBby9S6MrsW83Y9qZ%2Fuploads%2Fgit-blob-dd017bc770c17677f9ed9a4bb3b5f366e2bab216%2Fpublish-button.webp?alt=media)

场景发布后，你可以使用具有管理员权限的用户身份进入，并配置直播设置。

{% hint style="info" %}
**💡 提示**：如果添加了多个 Video Screen 来显示同一视频，请将其中一个屏幕以外的所有屏幕都配置为指向同一个视频播放器。详情请参阅 [Multiple Video Screens](https://docs.decentraland.org/creator/content-creator-zh/chang-jing-bian-ji-qi/jiao-hu-xing/video-screen.md#multiple-video-screens) 。
{% endhint %}

## DCL Cast（简易模式）

### 共享应用访问权限

以管理员身份进入已发布的场景，并打开管理面板。选择 **Video** 选项卡，然后选择 **DCL Cast** 功能。

<img src="https://2460066822-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoPnXBby9S6MrsW83Y9qZ%2Fuploads%2Fgit-blob-26e1a45982ee2316827a0ae1732bacb9ff447fa0%2Fdcl-cast.webp?alt=media" alt="DCL Cast" width="400">

你会看到两个可复制并分享给他人的链接。

* **演示者**：演示者可使用此链接将视频投放到场景中。

  <div data-gb-custom-block data-tag="hint" data-style="danger" class="hint hint-danger"><p><strong>❗警告</strong>：请将直播链接视为机密信息，只与信任的人分享。如有需要，可在不同演示者之间重置链接。</p><p>直播结束后，请关闭 DCL Cast 浏览器标签页，以释放频道。</p></div>
* **观众**：此链接供观众使用，可通过浏览器或移动设备观看视频。对于目前不在 Decentraland 中的玩家来说，这很实用。

点击 **复制链接** 按钮，将链接复制到剪贴板。

准备好开始直播后，点击 **激活** 按钮，让场景中的观众可以看到直播。

<img src="https://2460066822-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoPnXBby9S6MrsW83Y9qZ%2Fuploads%2Fgit-blob-bffafc4dfe2ab434c959e5ded1e751a589dc563b%2Factivate.webp?alt=media" alt="激活直播" width="150">

如果因任何原因需要重置房间，请点击 **重置房间** 按钮以生成一个新房间。当前正在直播的所有人都会断开连接。

<img src="https://2460066822-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoPnXBby9S6MrsW83Y9qZ%2Fuploads%2Fgit-blob-7d68402101d2b4cf539eca4a571ad1f3c6f48f3b%2Freset-room.webp?alt=media" alt="重置房间" width="150">

### 使用 DCL Cast 应用

有人将演讲者链接粘贴到浏览器中后，会看到如下界面：

<img src="https://2460066822-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoPnXBby9S6MrsW83Y9qZ%2Fuploads%2Fgit-blob-af60344e747edcc58f2d40d169d0f26e2ce3ac5b%2Fdcl-cast-landing.webp?alt=media" alt="DCL Cast 应用" width="400">

浏览器会请求访问摄像头和麦克风的权限。你还可以配置用于直播的输入设备。

{% hint style="info" %}
**📔 提示**：请使用 Google Chrome 或基于 Chrome 内核的浏览器。这些浏览器提供了便捷的功能，可直接从浏览器标签页共享视频和音频。
{% endhint %}

用户可以输入一个名称（不必与其 Decentraland 用户名相同），然后点击 **立即加入** 按钮开始直播。

开始直播后，该应用的使用方式与常见的视频会议应用类似，提供静音/取消静音、共享摄像头和屏幕的按钮，以及聊天界面。

聊天内容为只读，并会显示 Decentraland 场景内玩家发送的所有消息。即使你使用其他设备进行直播，也能借此与观众保持联系。

<img src="https://2460066822-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoPnXBby9S6MrsW83Y9qZ%2Fuploads%2Fgit-blob-0486fed88d8a6efd833fad8fcb90189ea0e274c4%2Fdcl-cast-app.webp?alt=media" alt="DCL Cast 应用" width="700">

在 **参与者** 标签页中，你可以看到三个列表：

* **演讲者**：当前正在向场景直播的人。
* **观众**：当前通过浏览器观看直播的人。
* **场景内参与者**：当前身处场景中并在场景内观看直播的玩家。

<img src="https://2460066822-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoPnXBby9S6MrsW83Y9qZ%2Fuploads%2Fgit-blob-fd393377fd8bb1713aac85767433c269823759c1%2Fparticipants.webp?alt=media" alt="参与者标签页" width="200">

如果 DCL Cast 会话中有多位演讲者，场景内的玩家会听到所有演讲者的声音；视频画面则会自动切换，显示当前正在发声的演讲者，以便始终展示正在讲话的人。

要覆盖此默认行为：

* 点击 **演讲者** 场景管理面板中的按钮

<img src="https://2460066822-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoPnXBby9S6MrsW83Y9qZ%2Fuploads%2Fgit-blob-3f94511c71560c7a233689dec5028bf5a68c2acd%2Fspeakers-button.webp?alt=media" alt="参与者标签页" width="200">

* 选择一位演讲者，并选择要展示的来源（该演讲者的摄像头或屏幕）

<img src="https://2460066822-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoPnXBby9S6MrsW83Y9qZ%2Fuploads%2Fgit-blob-5d8f08c21e62cc2e3eae9bd372d0b5fac0af87e1%2Fselect-speaker-source.webp?alt=media" alt="参与者标签页" width="200">

这样就会强制始终在屏幕上显示此来源，无论其他演讲者是否正在讲话。

{% hint style="info" %}
**📔 提示**：如果你也在场景内观看直播，DCL Cast 应用和 Decentraland 场景同时播放音频可能会造成回声，让人感到不适。你可以点击屏幕左下角的扬声器图标，轻松静音 DCL Cast 应用中的所有音频

<img src="https://2460066822-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoPnXBby9S6MrsW83Y9qZ%2Fuploads%2Fgit-blob-ddffca54e4ed8e5f901aa2f5f13bf089851fcf61%2Fmute-dcl-cast.webp?alt=media" alt="Participants tab" data-size="original">

也可以在 Decentraland 设置中静音。
{% endhint %}

### 共享演示文稿

你还可以共享幻灯片演示文稿的内容，将其作为图像的替代来源。

* 在场景内，点击 **共享演示文稿** 场景内 DCL Cast 标签页中的按钮。在 DCL Cast 应用中，点击旁边的下拉菜单 **共享屏幕** 按钮和选择框 **共享演示文稿**.

<img src="https://2460066822-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoPnXBby9S6MrsW83Y9qZ%2Fuploads%2Fgit-blob-14b7e6c47abdb3561606d1012a05658eab62e652%2Fshare-presentation-dcl-cast.webp?alt=media" alt="参与者标签页" width="200">

* 粘贴 Google 幻灯片链接、托管在云端硬盘或类似来源中的 .pdf 文件链接，或上传 .pdf 文件。

现在，该演示文稿将成为可选的屏幕显示来源，同时仍可听到所有发言者的声音。

{% hint style="warning" %}
**📔 注意**：演示文稿文件必须小于 100 MB。Google 幻灯片演示文稿必须设置为 *公开*.

在一次 DCL Cast 会话中，同一时间只能有一个正在播放的演示文稿。
{% endhint %}

之后，你可以切换幻灯片，甚至播放或暂停嵌入在幻灯片中的视频。只需按下 DCL Cast 应用和世界内“管理工具”界面中都有的按钮即可。

## 直播（高级）

要在场景中使用直播功能，你需要安装能够向 RTMP 端点输出视频流的直播软件（例如 [OBS](https://obsproject.com/), [XSplit](https://www.xsplit.com/), [StreamYard](https://streamyard.com/)).

{% hint style="warning" %}
**警告**：单人游戏世界不支持直播。如果你的世界在创作者中心的世界 **单人游戏** 选项已在 [设置标签页](https://docs.decentraland.org/creator/content-creator-zh/chang-jing-bian-ji-qi/fa-bu/manage-lands-and-worlds.md#settings) 中启用（或在 `fixedAdapter` 设为 `"offline:offline"` 的 `scene.json`中），请先将其禁用，再设置直播。直播功能依赖通信层，而单人游戏模式下通信层处于禁用状态。
{% endhint %}

### 获取直播凭据

1. 在场景中打开管理界面（右上角图标）。

   ![](https://2460066822-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoPnXBby9S6MrsW83Y9qZ%2Fuploads%2Fgit-blob-2901e04790c175df4992f4fcb8e4f333a265a3b9%2Fadmin-icon.webp?alt=media)
2. 在 **视频** 标签页中，切换到 **直播** 并点击 **获取直播密钥**.

   ![](https://2460066822-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoPnXBby9S6MrsW83Y9qZ%2Fuploads%2Fgit-blob-705bb2eb6916bcc6273a1487d0417b86f56940f7%2Fget-key.webp?alt=media)
3. 将 **RTMP 服务器** 和 **直播密钥** 复制到你的直播软件中。

   ![OBS configuration](https://2460066822-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoPnXBby9S6MrsW83Y9qZ%2Fuploads%2Fgit-blob-1147534dd5fe4215f5122cc0e4bc6a11146c3700%2FOBS-configuration.webp?alt=media)

{% hint style="danger" %}
**❗警告**：同一时间只能有一个人向场景推流。直播结束后，请在软件中点击 **停止直播** 以释放频道。
{% endhint %}

### 开始并控制直播

1. 在直播软件中开始推流。
2. 在管理界面中，点击 **激活** 即可在场景中显示直播流。

   <img src="https://2460066822-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoPnXBby9S6MrsW83Y9qZ%2Fuploads%2Fgit-blob-bffafc4dfe2ab434c959e5ded1e751a589dc563b%2Factivate.webp?alt=media" alt="激活直播" width="100">

### 直播密钥

直播密钥按场景生成，有效期为 4 天（96 小时）。单次直播最多可连续进行 4 小时。

![](https://2460066822-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoPnXBby9S6MrsW83Y9qZ%2Fuploads%2Fgit-blob-ea4bbab6f2430819e36ec9bcc244f38e8408320b%2Flive-stream-settings.webp?alt=media)

* 点击 **重置流密钥** 以撤销当前密钥并生成新密钥。正在进行的直播将会停止。
* 每个场景都有自己的直播地址和密钥。管理员可以将密钥分享给外部主播。
* 每个场景同一时间只能有一个直播流处于活动状态；启动新的直播流将覆盖当前直播流。

{% hint style="danger" %}
**❗警告**：请将流密钥视为机密信息。如有需要，可在更换演示者时重置密钥。
{% endhint %}

## 通过 URL 直播（高级）

您也可以将视频屏幕配置为使用 **视频 URL** 选项，然后粘贴直播 URL。

您应该可以粘贴指向大多数热门视频流媒体网站上视频的 URL。请留意这些平台的服务条款。

若要直播本地设备上的视频文件，最简单的方法是将视频上传到公开的 Google 云端硬盘，然后粘贴链接。

* URL 必须使用 `https`。请参阅 [关于外部直播](https://docs.decentraland.org/creator/content-creator-zh/chang-jing-sdk7/mei-ti/video-playing.md#about-external-streaming).
* 推荐的服务提供商包括 [Vimeo](https://vimeo.com/), [Bunny](https://bunny.net), [Livepeer Studio](https://livepeer.studio/) 和 [Serraform](https://serraform.gitbook.io/streaming-docs/guides/decentraland-playback).
* 编码器设置提示： [设置 OBS 以确保直播成功](https://docs.decentraland.org/creator/content-creator-zh/chang-jing-sdk7/mei-ti/video-playing.md#setting-up-obs-for-successful-streaming).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.decentraland.org/creator/content-creator-zh/chang-jing-bian-ji-qi/shi-shi-yun-ying/live-streaming.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
