Audio element

  • The <audio> element is useful for embedding an audio player into a Web page. It is dedicated for streamed audio. It is very similar to the <video> element, both in its use and in its API.
  • The “Web Audio API” is designed for musical applications and for adding sound effects to games. This pure JavaScript API supports manipulation of sound samples (loops, etc.), music synthesis and sound generation (oscillators, etc.). It also comes with a set of predefined sound processing modules (reverb, delay, etc.).

Example:

  1. <html lang=”en”>
  2. <body>
  3.   <audio controls=“controls”>
  4.       <source src=https://dl.dropboxusercontent.com/u/1631516/horse.ogg&#8221;
  5.               type=“audio/ogg” />
  6.       <source src=https://dl.dropboxusercontent.com/u/1631516/horse.mp3&#8221;
  7.               type=“audio/mp3” />
  8.       Your browser does not support the audio element.
  9.       Download the audio/video in
  10.      <a href=”https://dl.dropboxusercontent.com/u/1631516/horse.ogg”>OGG</a>
  11.      or <ahref=”https://dl.dropboxusercontent.com/u/1631516/horse.mp3”>MP3</a>
  12.      format.
  13. </audio>
  14. </body>
  15. </html>

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s