Tengo el siguiente código fuente de JavaScript que obtuve del enlace https://www.studytonight.com/post/capture-photo-using-webcam-in-javascript :
function startup() { video = document.getElementById('video'); canvas = document.getElementById('canvas'); photo = document.getElementById('photo'); startbutton = document.getElementById('startbutton'); // access video stream from webcam navigator.mediaDevices.getUserMedia({ video: true, audio: false }) // on success, stream it in video tag .then(function(stream) { video.srcObject = stream; video.play(); }) .catch(function(err) { console.log("An error occurred: " + err); });Mi pregunta es qué está pasando con la siguiente parte de este código fuente:
.then(function(stream) { video.srcObject = stream; video.play(); }) .catch(function(err) { console.log("An error occurred: " + err); });¿Puede alguien explicar qué está haciendo la sección .then(function(stream) en este caso particular? Gracias.