How to turn off webcam after ending meeting with amazon chime sdk

Viewed 725

I've got a video conference website using aws-chime-sdk-js, and I've got a button that stops the current meeting. The problem is that I can't get the webcam to stop showing itself as recording (led light and red icon), even after following these function calls outlined below:

https://aws.github.io/amazon-chime-sdk-js/modules/faqs.html#after-leaving-a-meeting-the-camera-led-is-still-on-indicating-that-the-camera-has-not-been-released-what-could-be-wrong

const stop = async (meetingId) => {
try {
    const response = await API.post("chime", "/chime/end", {
    body: { meetingId },
    });

    console.log(response);
    // Select no video device (releases any previously selected device)
    meetingSession.audioVideo.chooseVideoInputDevice(null);

    // Stop local video tile (stops sharing the video tile in the meeting)
    meetingSession.audioVideo.stopLocalVideoTile();

    meetingSession.audioVideo.stop();
} catch (e) {
    console.log(e);
}
};

I've even tried releasing the tracks individually with getUserMedia to no avail. Any ideas how to turn off the webcam?

1 Answers

You could reload the window when your component is unmounting, or right after you end the meeting. The action of reloding the page turns off the cam that was already turned on. For example, using javascript.

window.location.reload();
Related