简体   繁体   中英

Extract audio from a video blob with vanilla JavaScript

On a web page, after recording screen video and audio using navigator.mediaDevices.getDisplayMedia and a MediaRecorder , I end up with a video blob. How can I extract using only vanilla JavaScript on the client the audio from that blob and for example have it downloaded to the user? I'm simply looking for this function:

async function extractAudio(videoBlob) {
  // ...

  return audioBlob;
}

I made it work with the video-to-audio npm package. It wasn't working at first but now it's all good.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM