How to see users webcam in html | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to see users webcam in html

I have watched a video (https://www.youtube.com/watch?v=CVClHLwv-4I) to try to access the webcam using JavaScript and then changing the video tag source to the users webcam, but it still isn’t working for me and I don’t know why. I know though, navigator.getUserMedia is deprecated and you now have to use navigator.mediaDevices.getUserMedia. Please help me on how to do this.

3rd May 2022, 2:06 AM
Wellington N
9 Answers
+ 1
Sorry for the delay I just found your notification. Are you still working on this project? If so yes please share show your code.
8th May 2022, 6:38 AM
Chris Coder
Chris Coder - avatar
0
What code editor are you using?
3rd May 2022, 4:23 AM
Chris Coder
Chris Coder - avatar
0
Visual Studio Code
3rd May 2022, 11:37 AM
Wellington N
0
Do you want me to show you my code?
3rd May 2022, 11:37 AM
Wellington N
0
Yes. My code wasn’t pasting here just right now so here is my code: https://pastebin.com/WkfRCSaD
8th May 2022, 11:28 AM
Wellington N
0
What is eternal javascript? I am using the live server VSCode extension.
8th May 2022, 9:49 PM
Wellington N
0
You are missing part of the JS script. Go back to the video at 2:47 and copy exactly how you see it. Make sure you have the live view extension installed and the face-api.js library installed. Good luck!
8th May 2022, 9:56 PM
Chris Coder
Chris Coder - avatar
0
If after correctly writing the JavaScript code and ensuring the extension is running: if it still does not work then, it is likely the APi is what is used to call the correct functions to access the webcam.
8th May 2022, 10:06 PM
Chris Coder
Chris Coder - avatar
0
Ok, thanks!
8th May 2022, 10:06 PM
Wellington N