top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How you play an audio using HTML5?

+1 vote
332 views
How you play an audio using HTML5?
posted Nov 26, 2015 by Jayshree

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

Its been discussed earlier also. See the following example

Example 1:

<audio src="/test/audio.ogg">
<p>Your browser does not support the <code>audio</code> element.</p>
</audio>

Example 2

<audio src="audio.ogg" controls autoplay loop>
<p>Your browser does not support the <code>audio</code> element </p>
</audio>

controls : Displays the standard HTML5 controls for the audio on the web page.
autoplay : Makes the audio play automatically.
loop : Make the audio repeat (loop) automatically.

Example 3:

<audio src="audio.mp3" preload="auto" controls></audio>

The preload attribute is used in the audio element for buffering large files. It can take one of 3 values:    
"none" does not buffer the file
"auto" buffers the media file
"metadata" buffers only the metadata for the file
answer Nov 26, 2015 by Salil Agrawal
...