Error:
Uncaught (in promise) DOMException: Could not start video source Lo que probé:
Verifiqué que mi Chrome puede acceder a la cámara y estaba permitido.
Intenté actualizar la unidad de mi cámara, pero no había actualizaciones disponibles.
Este error viene principalmente, pero a veces mi sitio no da este error.
Cómo resolver este problema?
Es un problema de mi computadora portátil y todavía dice que mi código tiene un error. Por favor, dé alguna solución.
Código:
getDevices: async function(){ let $this = this; navigator.mediaDevices .enumerateDevices() .then(function(devices) { devices.forEach(function(device) { if(device.kind == "audioinput"){ $this.microphones.push(device); } else if(device.kind == "audiooutput"){ $this.speakers.push(device); } else if(device.kind == "videoinput"){ $this.cameras.push(device); } }); }); let videoStream = await navigator.mediaDevices.getUserMedia({video: true,audio: false}); let audioStream = await navigator.mediaDevices.getUserMedia({video: false,audio: true}); const combinedStream = new MediaStream( [ ...videoStream.getVideoTracks(), ...audioStream.getAudioTracks() ] ); document.getElementById("myVideo").srcObject=combinedStream; document.getElementById("myVideo").muted = true; }, setCamera: async function(){ let videoStream = await navigator.mediaDevices.getUserMedia({video:{deviceId:this.selectedCamera},audio: false}); let audioStream = await navigator.mediaDevices.getUserMedia({video: false,audio: true}); const combinedStream = new MediaStream( [ ...videoStream.getVideoTracks(), ...audioStream.getAudioTracks() ] ); document.getElementById("myVideo").srcObject=combinedStream; document.getElementById("myVideo").muted = true; }, //It says that The error is on this line and the error is Uncaught (in promise) DOMException: Could not start video source.-Gracias por todas sus soluciones