1

A website is playing audio. There are no <audio> tags evident in Inspect Element tab from DevTools. How do I get an audio file to download from the webpage (and how are they playing the audio)?

After a bit of research, it seems the only way to play audio is through the audio (<audio></audio>) element, which has the DOM interface, HTMLAudioElement (new Audio()) constructor.

So, I'm not entirely sure how they're playing audio without the audio element or how to find the audio being played from new Audio().

A new Audio was called in only one file but seemed to only be used in a condition:

enter image description here

Tigerrrrr
  • 526
  • 6
  • 24
  • That is not "the only way" (see link at the end), but if you are trying to capture a sound, you have better chances to do it with the Network tab of your inspector. Link: https://stackoverflow.com/questions/9419263/how-to-play-audio – savageGoat Mar 22 '22 at 12:04
  • @savageGoat Thank you (would've been better as an answer, though), I'll see if I can use the Network tab to help me. – Tigerrrrr Mar 22 '22 at 17:07
  • Also, as for the link, I looked at the question prior to asking and all the answers use the same two methods I showed in my question. There was 1 other method I found (through the SO question that I hyperlinked under "the only way to play audio") but it had 2 downvotes, which was a lot when compared to the number of upvotes the other answer and question had so I assumed it was a bad or unconventional method or it just doesn't work (it didn't work for when I tested it, but then I realized the audio file he used is just not available anymore). – Tigerrrrr Mar 22 '22 at 17:15
  • Anyways, after using your Network tab suggestion, it turns out this website in question is actually using that method with 2 downvotes... which is quite ironic I guess. So... problem solved! I'll write an answer to this question. – Tigerrrrr Mar 22 '22 at 17:16
  • The biggest problem in this kind of situation is that we can't magically know where the source comes from as you are talking about a webite you went to and not that you did. But glad you found the answer! – savageGoat Mar 23 '22 at 00:40

1 Answers1

1

After some digging, there seem to be three methods of playing audio:

  1. <audio> element
  2. HTMLAudioElement interface
  3. XMLHttpRequest object

And to get the audio from the webpage, the best method is to use the Network tab which basically logs everything that happens on the webpage, as shown here:

Screenshot of a Network tab

If you right-click on the file names (with their extensions) that are logged directly below the "played", you'll see an option in the context menu labeled "Open in new tab". And that's it!

Tigerrrrr
  • 526
  • 6
  • 24