What are audio formats?

There are two associated terms: containers and codecs.


– The music or audio file we have with us is in the form of “container“.
– For an audio file, it would contain a combination of audio and metadata information related to the audio.
– The “container” is the file format used to package together the audio and metadata information.

– Some common examples of container formats are:

Note: For a video file, the container would package together the video, audio and metadata information.

– The codec is basically the software used to encode and decode(an encoded audio).
– Some examples of popular codecs are:
VP8, AAC, H.264, Vorbis and Theora

The browsers basically decide which audio files they can decode and therefore we need to provide multiple encoded audio files for the browser to choose from.


What do we mean by API in relation to the HTML5 audio element?

As we all know, api stands for “application programming interface“. It’s this api which allows us to interact with and control the audio element.

The api for audio element can be accessed / used through:
1. Accessing properties of the audio element
2. Calling methods on the audio element
3. Catching events