Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

214
Visualizações
Webcam Access for Custom Filters:vTypeError: URL.createObjectURL: Argument 1 is not valid for any of the 1-argument overloads

I am currently trying to improve my JS skills by going through WesBos's 30 Days of JavaScript. (It is really fun if!) I'm currently on Day 19, which is about using JS to access the WebCam, and then add affects using CSS.

I was successfully able to set up a local server, and here is my code so far:

 function getVideo() {
        navigator.mediaDevices.getUserMedia({video: true, audio: false})
        .then(localMediaStream => {
            console.log(localMediaStream);
            video.src = window.URL.createObjectURL(localMediaStream);
            video.play();
        })
        .catch(err => {
            console.error(`Web camera access is not enabled. To resolve, reload the page and allow 
    access.`, err);
        });
    }
    
    getVideo();

However, I am getting this error:

    TypeError: URL.createObjectURL: Argument 1 is not valid for any of the 1-argument overloads.
    getVideo http://localhost/19-webcam-fun/scripts.js:12
    promise callback*getVideo http://localhost/19-webcam-fun/scripts.js:10
    <anonymous> http://localhost/19-webcam-fun/scripts.js:27

Idk if this helps, but the console.log(localMediaStream) results in the following:


    MediaStream { id: "{97c3d27e-404e-4d14-b1d2-2a9ebbf09137}", active: true, onaddtrack: null, 
    onremovetrack: null }
    ​
    active: true
    ​
    id: "{97c3d27e-404e-4d14-b1d2-2a9ebbf09137}"
    ​
    onaddtrack: null
    ​
    onremovetrack: null
    ​
    <prototype>: MediaStreamPrototype { getAudioTracks: getAudioTracks(), getVideoTracks: 
    getVideoTracks(), getTracks: getTracks(), … }

I would really appreciate it if someone could help me understand this a little better! Thanks!

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda