Pages

Monday, 13 February 2017

HTML 5 Audio

In HTML 4 audio was play using any plugin like flash or Microsoft silver light but in HTML 5 audio player is updated so no need to install any other plugin browser automatically plays it.

<audio controls>
  <source src="xxx.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>


The controls attribute adds audio controls, like play, pause, and volume.The <source> element allows you to specify alternative audio files which the browser may choose from. The browser will use the first recognized format.The text between the <audio> and </audio> tags will only be dis
played in browsers that do not support the <audio> element.
Audio - Media format


File Format
Media Type
MP3
audio/mpeg
Ogg
audio/ogg
Wav
audio/wav

Example

<!DOCTYPE html>
<html>

   <head>
      <meta charset="utf-8">
      <title>Girfa : Student Help HTML5 Audio</title>
   </head>
<body>       
     <h1 align="center">Girfa : Student Help HTML5 Audio</h1><hr>

<audio controls>
  <source src="audio.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
     
</body>  
</html>


No comments:

Post a Comment