Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

233
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!