0

我们正在使用 AWS Chime SDK 创建一个视频应用程序。

我们希望一些用户能够加入会议只是为了观看。没有任何添加视频/音频功能。

到目前为止,我们的应用程序为与会者请求了一个加入令牌并将其发送回客户端:

{
"Attendee":
    {
    "AttendeeId":"b0637fd9-0140-3412-a51a-2c51ebd8fd08",
    "ExternalUserId":"MaavEFZt1DEfy",
    "JoinToken":"YjA2MzdmZDktMGZmMC04MTMyLWE1MWEtjBiYWU0YWE3LWVhYjctNDBkZS1iMjE4LTYyOWVlNGVmNTAxOA",
    "Tags":null
    }
}

然后,与会者可以使用以下代码观看会议:

/*----------------------------------------------*/
/* Create meeting session and init              */
/*----------------------------------------------*/
const MeetingResponse = 'some json representing the meeting response';
const ParticipantResponse = 'previous participant response';

const logger = new ChimeSDK.ConsoleLogger('ChimeMeetingLogs', ChimeSDK.LogLevel.INFO);
const deviceController = new ChimeSDK.DefaultDeviceController(logger);      
const configuration = new ChimeSDK.MeetingSessionConfiguration(MeetingResponse, ParticipantResponse);

const meetingSession = new ChimeSDK.DefaultMeetingSession(configuration, logger, deviceController);

/*----------------------------------------------*/
/* Create the observer                          */
/*----------------------------------------------*/              
const observer = {
      audioVideoDidStart: ()                        => {dosomething();},
      audioVideoDidStop: sessionStatus              => {console.log('Stopped with a session status code: ', sessionStatus.statusCode());},
      audioVideoDidStartConnecting: reconnecting    => {if (reconnecting) {console.log('Attempting to reconnect');}},
      
      videoTileDidUpdate: tileState => {
        if (!tileState.boundAttendeeId) {return;}
        meetingSession.audioVideo.bindVideoElement(tileState.tileId, SomeHtmlElement);              
      }
    };      

meetingSession.audioVideo.addObserver(observer);
meetingSession.audioVideo.start();

这段代码工作正常。然而问题是我们希望这个与会者只能观看会议。如果他手动运行以下代码,他的视频/音频将被添加到我们不想要的会议中。

audioInputDevices = await meetingSession.audioVideo.listAudioInputDevices();
audioOutputDevices = await meetingSession.audioVideo.listAudioOutputDevices();  
videoInputDevices = await meetingSession.audioVideo.listVideoInputDevices();
    
const audioInputDeviceInfo = audioInputDevices[0];          
await meetingSession.audioVideo.chooseAudioInputDevice(audioInputDeviceInfo.deviceId);

const audioOutputDeviceInfo = audioOutputDevices[0];            
await meetingSession.audioVideo.chooseAudioOutputDevice(audioOutputDeviceInfo.deviceId);            

const videoInputDeviceInfo = videoInputDevices[0];
await meetingSession.audioVideo.chooseVideoInputDevice(videoInputDeviceInfo.deviceId);  

我们考虑在其他客户端上添加一个条件,以检查是否允许用户加入讨论,然后再将他添加到他们的堆中,但这不是一个可靠的解决方案。因为,即使他的视频不会在其他客户端中显示,他仍然会发送视频并消耗 Chime 带宽。嗨音频也将与其他参与者混合。

所以我想知道是否有任何解决方案可以强制与会者处于“仅观看”模式而不发送任何音频或视频?

感谢和问候。

4

0 回答 0