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

220
Views
How to download URL from CreateObjectURL and save it in a folder

I'm making a website that can record audio for 5 seconds, it works, but when the 5 seconds finish I want the audio to download or to be save in a folder of my project, is it posible? here is my code:

navigator.mediaDevices.getUserMedia({ audio: true })
  .then(stream => {
    const mediaRecorder = new MediaRecorder(stream);
    mediaRecorder.start();


    const audioChunks = [];

    mediaRecorder.addEventListener("dataavailable", event => {
      audioChunks.push(event.data);

    });

    mediaRecorder.addEventListener("stop", () => {
      const audioBlob = new Blob(audioChunks)
      const audioUrl = URL.createObjectURL(audioBlob);
      const audio = new Audio(audioUrl);
      audio.play();
    });

And I want to make something like this

    mediaRecorder.addEventListener("stop", () => {
      const audioBlob = new Blob(audioChunks)
      const audioUrl = URL.createObjectURL(audioBlob);
      const audio = new Audio(audioUrl);
      audio.play();
      audio.save("direction-of-the-folder/") // MAKE this
    });

Thank you in advance:)

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

The File System Access API can provide access to the local file system (see tutorial). The recorded audioChunks can be also be downloaded via:

function download(audioChunks) {
  const a = document.createElement('a')
  a.href = URL.createObjectURL(new Blob(audioChunks))
  a.download = 'my-audio.webm'
  a.click()
}
about 4 years ago · Juan Pablo Isaza Report
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!