navigator.mediaDevices.getUserMedia() is a promise-based browser API from the Media Capture spec that, in secure (HTTPS/localhost) pages, prompts the user for permission to access their camera and/or microphone. When granted, it returns a MediaStream (one or more audio/video tracks) that you can attach to a <video> element, feed into WebRTC, record, or process in real-time.