Playing Audio in the Browser The Audio Element

Learning objective: By the end of this lesson, students will have a comprehensive understanding of the <audio> HTML element.

The <audio> element

The <audio> element can be used in the webpage in other ways, for example, to play a background audio clip in a continuous loop.

Attributes, such as loop, can be set in the <audio> element directly or manipulated via JS. For example, the element may have its default controls shown by adding the controls attribute (no value is necessary).

To learn even more about what the <audio> element can do, here are the docs for more info: Audio HTML Element.