我需要为一位与会者提供选项,以使 amazon chime 中的所有其他与会者静音。我正在使用 amazon-chime-sdk-js。
问问题
131 次
1 回答
1
Currently, there is no for mute/unmute Remote Attendee or mute all/unmute all option available in Amazon Chime SDK But yes we can use real-time messaging to achive this
添加realtimeSubscribeToReceiveDataMessage
这样{channel-name}
,当用户加入会议时,它将在此频道上收到消息。
就像下面的代码片段中提到的那样
const realtimeSubscribeToReceiveGeneralDataMessage = async () => {
chime.audioVideo &&
(await chime.audioVideo.realtimeSubscribeToReceiveDataMessage(MessageTopic.GeneralDataMessage, async (data) => {
const receivedData = (data && data.json()) || {};
const { type, attendeeId } = receivedData || {};
if (attendeeId !== chime.attendeeId && type === 'MUTEALL') {
chime.audioVideo && (await chime.audioVideo.realtimeMuteLocalAudio());
} else if (attendeeId !== chime.attendeeId && type === 'STOPALLVIDEO') {
chime.audioVideo && (await chime.audioVideo.stopLocalVideoTile());
}
}));
chime.attendeeId
您的attendeId 和频道名称在哪里GeneralDataMessage
您需要添加一个按钮以将所有视频静音并停止所有视频
<Button
type="button"
onClick={() => {
chime.sendMessage(MessageTopic.GeneralDataMessage, {
type: 'MUTEALL',
});
}}
>
{'Mute All'}
</Button>
<Button
type="button"
onClick={() => {
chime.sendMessage(MessageTopic.GeneralDataMessage, {
type: 'STOPALLVIDEO',
});
}}
>
{'Stop All Video'}
</Button>
这是通过通道向所有远程与会者发送消息的方法
sendMessage = (data) => {
new AsyncScheduler().start(() => {
const payload = {
...data,
attendeeId: this.attendeeId || '',
name: this.rosterName || '',
};
this.audioVideo &&
this.audioVideo.realtimeSendDataMessage(MessageTopic.GeneralDataMessage, payload, ChimeSdkWrapper.DATA_MESSAGE_LIFETIME_MS);
this.publishMessageUpdate(
new DataMessage(
Date.now(),
MessageTopic.GeneralDataMessage,
new TextEncoder().encode(payload),
this.meetingSession.configuration.credentials.attendeeId || '',
this.meetingSession.configuration.credentials.externalUserId || '',
),
);
});
这是参考问题:点击这里
于 2021-04-08T07:47:42.430 回答