tezvyn:

Requesting Camera and Mic Access with getUserMedia

Source: developer.mozilla.orgbeginner

getUserMedia asks for camera/mic access in the browser. It's used for video chats or photo booths and returns a Promise with the media stream. Footgun: The promise can hang forever if the user ignores the prompt, so your app must handle that state.

getUserMedia is the browser's way to ask for permission to use a camera or microphone. This asynchronous request returns a Promise, forming the foundation for video conferencing or photo capture apps. You specify your needs (audio, video, or both) in a constraints object. Footgun: The promise can hang forever if the user ignores the prompt, and the entire feature only works over a secure HTTPS connection, failing otherwise.

Read the original → developer.mozilla.org

Get five bites like this every day.

Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.

Requesting Camera and Mic Access with getUserMedia · Tezvyn