Safari Technology Demos

Back to Overview
Audio
Best Viewed: Safari on iOS, Mac OS X, Windows

Audio

The HTML5 <audio> element lets you add audio to your web page with a single line of code. Like other elements in a web page, the <audio> element can be controlled and queried using JavaScript. You can programmatically pause, play, seek, check the current playback position, and more. And, you can listen for DOM events that alert your code to important events, such as volume changes or the end of a song. When you deliver audio with HTML5, users can enjoy sound in your web pages without downloading any additional software.

In this example:

  • Sound is played using the HTML5 <audio> tag.
  • Reflection is added with -webkit-box-reflect.
  • Progress updates are drawn on the play button with HTML5 <canvas>.

Related Resources