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

234
Visualizações
Play mp3 song while recording video and after recording end, play that song along with recorded video through getusermedia stream

let defaultsOpts = { audio: true, video: true }

function capture(){
  // Step - 1.Checking Device Support
if (
  "mediaDevices" in navigator &&
  "getUserMedia" in navigator.mediaDevices
) {
  defaultsOpts.video = { facingMode: state?.shouldFaceUser ? 'user' : 'environment',
   width: window.screen.height, height: window.screen.width,
   }

  // Requesting user permission
  navigator.mediaDevices
    .getUserMedia(defaultsOpts)
    .then((stream) => {
      // video element
      window.videoElement = document.getElementById("preview");
      window.stream = stream;
      window.track = window?.stream?.getVideoTracks()[0];

      if('srcObject' in window.videoElement){
        window.videoElement.srcObject = window.stream;
      }else{
        // older version
        window.videoElement.src = window.URL.createObjectURL(window.stream);
      }
      window.videoElement.captureStream =
      window.videoElement.captureStream || window.videoElement.mozCaptureStream;
        return new Promise(resolve => window.videoElement.onplaying = resolve)
    })
    .catch((log) => {
      alert("User Denied accessing camera & audio device", log);
    });
}else{
  alert("your browser does not support camera")
}
}
capture();

here inside capture function, video stream gets started and it records the audio through default microphone.but i want to play and record user uploaded file(mp3 song) and play that song along with video after recording the stream.

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