Stop/Close webcam stream which is opened by navigator.mediaDevices.getUserMedia

I opened a webcam by using the following JavaScript code: const stream = await navigator.mediaDevices.getUserMedia({ /* … */ }); Is there any JavaScript code to stop or close the webcam? Thanks everyone. Answers: Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue … Read more