

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 在 Amazon Chime SDK 会议中使用媒体复制
<a name="media-replication"></a>

您可以使用媒体复制将主 WebRTC 会话与多个副本会话关联，以覆盖更多的受众。每个 WebRTC 媒体会话支持 250 个连接，并且您可以将一个主会话复制到多个副本会话。连接到副本会话的参与者只能接收连接到主会话的主讲人的音频和视频。他们对连接到复制会话的参与者一无所知，这使得媒体复制非常适合网络研讨会和其他需要隐私的使用案例。

下图显示了带有主讲人共享音频和视频的主会话与参与者使用媒体的副本会话之间的媒体复制。

![\[主会话中的主讲人共享。\]](http://docs.aws.amazon.com/zh_cn/chime-sdk/latest/dg/images/replication-1.png)


**注意**  
*Chime SDK Meetings — 每个主会议的副本会议*的服务限额默认值为 4，您可以根据请求提高该限制。有关限额的更多信息，请参阅*AWS 一般参考*中的 [AWS 服务限额](https://docs.aws.amazon.com/general/latest/gr/aws_service_limits.html)。

**Topics**
+ [互动参与者](#interactive-participants)
+ [全球参与者](#global-participants)
+ [会话生命周期](#session-lifecycle)

## 互动参与者
<a name="interactive-participants"></a>

可向连接到副本会话的参与者授予加入主会话的访问权限。由于每个人都使用 WebRTC 连接，因此主讲人和参与者不会遇到转码延迟。当参与者在主会话和副本会话之间切换时，他们会重复使用自己的 WebRTC 连接，因此切换速度非常快。这使参与者能够在不错过任何内容的情况下仍能进行实时对话。

下图显示了副本会话的参与者使用其 WebRTC 连接切换到主会话。

![\[显示两个参与者从副本会话切换到主会话的示意图。\]](http://docs.aws.amazon.com/zh_cn/chime-sdk/latest/dg/images/replication-2.png)


## 全球参与者
<a name="global-participants"></a>

您可以为每次 WebRTC 媒体会话选择 AWS 区域。这使您能够在比主会话所在区域更靠近参与者的区域中创建副本会话。执行此操作时，媒体会通过 AWS 网络从主会话流向副本会话，然后通过 Internet 从副本会话流向参与者。向全球受众演示时，将副本会话创建于参与者附近可以帮助确保媒体通过 AWS 网络而不是互联网在全球传输，从而获得更好的会议体验。

下图显示了不同区域的主会话和副本会话。

![\[3 个区域的参与者观看演示文稿的示意图。\]](http://docs.aws.amazon.com/zh_cn/chime-sdk/latest/dg/images/replication-3.png)


## 会话生命周期
<a name="session-lifecycle"></a>

创建会话  
你用 [https://docs.aws.amazon.com/chime/latest/APIReference/API_meeting-chime_CreateMeeting.html](https://docs.aws.amazon.com/chime/latest/APIReference/API_meeting-chime_CreateMeeting.html) 或 [https://docs.aws.amazon.com/chime/latest/APIReference/API_meeting-chime_CreateMeetingWithAttendees.html](https://docs.aws.amazon.com/chime/latest/APIReference/API_meeting-chime_CreateMeetingWithAttendees.html) APIs 创建 WebRTC 媒体会话。默认情况下，除非您专门 APIs 创建副本会话，否则将创建主会话。  
您可以通过在 `CreateMeeting` 或 `CreateMeetingWithAttendees` API 调用中将主会话的 `MeetingId` 指定为 `PrimaryMeetingId` 来创建副本会话。  
如果您将副本会话的 `MeetingId` 指定为 `PrimaryMeetingId`，则 API 调用将失败。

创建与会者  
 要创建加入WebRTC媒体会话所需的与会者证书，可以使用 [https://docs.aws.amazon.com/chime/latest/APIReference/API_meeting-chime_CreateMeetingWithAttendees.html](https://docs.aws.amazon.com/chime/latest/APIReference/API_meeting-chime_CreateMeetingWithAttendees.html), [https://docs.aws.amazon.com/chime/latest/APIReference/API_meeting-chime_BatchCreateAttendee.html](https://docs.aws.amazon.com/chime/latest/APIReference/API_meeting-chime_BatchCreateAttendee.html) 或 [https://docs.aws.amazon.com/chime/latest/APIReference/API_meeting-chime_CreateAttendee.html](https://docs.aws.amazon.com/chime/latest/APIReference/API_meeting-chime_CreateAttendee.html) APIs.   
为大量与会者创建会话时，使用 `CreateMeetingWithAttendees` 或 `BatchCreateAttendee` 以最大限度地减少所需的 API 调用次数。

删除与会者  
你用 [https://docs.aws.amazon.com/chime/latest/APIReference/API_meeting-chime_DeleteAttendee.html](https://docs.aws.amazon.com/chime/latest/APIReference/API_meeting-chime_DeleteAttendee.html)用于撤销参加 WebRTC 媒体会话的与会者凭证的 API。如果与会者已连接到会议，他们将断开连接并且无法重新加入。  
当你使用 [https://docs.aws.amazon.com/chime/latest/APIReference/API_meeting-chime_DeleteMeeting.html](https://docs.aws.amazon.com/chime/latest/APIReference/API_meeting-chime_DeleteMeeting.html)API 用于删除 WebRTC 媒体会话，它会自动删除所有与会者，您无需致电。`DeleteAttendee`

切换会话  
要允许参与者从副本会话切换到主会话，您必须在主会议中为他们创建凭证。请参阅此列表前面的*创建与会者*。使用 Amazon Chime SDK 客户端库中带有 `promoteToPrimaryMeeting` 方法的凭证切换到主会话。  
要将参与者切换回副本会话，请使用 Amazon Chime SDK 客户端库中的`demoteFromPrimaryMeeting`方法，或者使用 [https://docs.aws.amazon.com/chime/latest/APIReference/API_meeting-chime_DeleteAttendee.html](https://docs.aws.amazon.com/chime/latest/APIReference/API_meeting-chime_DeleteAttendee.html)使他们的主会话凭证失效的 API。  
直接连接到主会话的主讲人无法切换到副本会话。
有关在会话之间切换的更多信息，请参阅客户端库文档：  
+ [安卓版 Amazon Chime SDK 已开启。](https://github.com/aws/amazon-chime-sdk-android) GitHub
+ 适用于 [iOS 的 Amazon Chime SDK 已开启。](https://github.com/aws/amazon-chime-sdk-ios) GitHub
+ 适用于 on 的 [Amazon Chime SDK 客户端库。 JavaScript](https://github.com/aws/amazon-chime-sdk-js) GitHub

删除会话  
你用 [https://docs.aws.amazon.com/chime/latest/APIReference/API_meeting-chime_DeleteMeeting.html](https://docs.aws.amazon.com/chime/latest/APIReference/API_meeting-chime_DeleteMeeting.html)用于删除 WebRTC 媒体会话的 API。  
如果您删除主会话，`DeleteMeeting` API 会自动删除所有附加的副本会话。因此，要删除所有会话，只需删除主会话即可。  
如果连续 5 分钟内没有与会者连接，则该服务会自动删除主会话。该服务仅在删除主会话时自动删除副本会话。也就是说，您可以在创建主会话时创建副本会话，并且副本将在主会话期间可用。