Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

227
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda