79299518

Date: 2024-12-21 13:57:41
Score: 1
Natty:
Report link

HTMLAudioElement and AudioBuffer are two separate things which do not interact, for each case the correct one should be chosen, both of them can server the same purpose but the choice should be made according to the circumstances.

An HTMLAudioElement object loads a file and has its own controls (play, stop etc..).

An AudioBuffer object will represent a usually short audio clip saved in memory, created by loading a file as well, this one is played by passing it into AudioBufferSourceNode, which is "parallel" to the controls you have in an HTMLAudioElement.

I advise reading the docs for clarity:

https://developer.mozilla.org/en-US/docs/Web/API/HTMLAudioElement

https://developer.mozilla.org/en-US/docs/Web/API/AudioBuffer

https://developer.mozilla.org/en-US/docs/Web/API/AudioBufferSourceNode

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Low reputation (1):
Posted by: Yuval Jacobson