Search code examples
aws-chime-sdkamazon-chime

AWS Chime SDK: How to leave a meeting


I've a React JS App that uses the Chime SDK. I've literally followed the explanation here and i can successfully hold a meeting with two attendees. My issue is the behaviour when one of the participants leaves the meeting.

My references are:

  • This link states "To stop the meeting session, call meetingSession.audioVideo.stop()."
  • This link states "You start tearing down a session by calling stop on the AudioVideoFacade .... this.audioVideo.stop();"

When i run meetingSession.audioVideo.stop() the attendee appears to leave the meeting (their audio and video stops) - which makes sense. My issues are:

  1. Locally, the attendee's audio and video are still showing as active in the browser. How do i release them? I've tried setting the meetingSession object to null but it didn't work
  2. If i then run meetingSession.audioVideo.start() the attendee rejoins the meeting but with a new Tile ID. Why isn't the same Tile ID used if the Attendee is the same?

Overall it seems my issues all relate to being unclear how to leave a meeting and a) be removed from the meeting roster and b) release objects locally in the browser.

Thanks in advance


Solution

  • I found the answer. Key context is:

    • When in a video session Chrome displays the camera icon chrome camera icon and the record icon chrome record icon
    • The camera icon displays when a page has permission to use video
    • The record icon displays when a page is using the video

    In my previous post i was expecting both icons to disappear after leaving a session, however, the camera icon always remains because the permission remains.

    There was one other bit of information missing. The docs state you should run meetingSession.audioVideo.stop() but this is incomplete. The FAQs also state that you should run:

    • meetingSession.audioVideo.chooseVideoInputDevice(null);
    • meetingSession.audioVideo.stopLocalVideoTile();
    • meetingSession.audioVideo.stopVideoPreviewForVideoInput(previewVideoElement);

    BEFORE running meetingSession.audioVideo.stop(). Doing this fixed the issue and the chrome record icon icon disappeared.

    Point 2 above regarding the Tile ID is still unclear but this is likely a separate issue.