<
audio
controls autoplay>
<
source
src
=
"https://s3.amazonaws.com/Syntaxxx/bigger-picture.mp3"
type
=
"audio/mpeg"
>
<
p
>If you can read this, your browser does not support the audio element.</
p
>
</
audio
>
<
audio
controls autoplay>
<
source
src
=
"https://s3.amazonaws.com/Syntaxxx/bigger-picture.mp3"
type
=
"audio/mpeg"
>
<
p
>If you can read this, your browser does not support the audio element.</
p
>
</
audio
>
How To Make The Audio Player Autoplay
To autoplay the audio, you simply add the
autoplay
attribute to the HTML5 audio
element:
1
2
3
4
| < audio controls autoplay> < p >If you can read this, your browser does not support the audio element.</ p > </ audio > |
That’s it. Just make sure the
source src
is pointed at the correct audio file. The audio types supported are:- MP3 (audio/mpeg)
- Ogg (audio/ogg)
- Wav (audio/wav)
More Audio Player Info
1
2
3
4
5
6
| < audio controls autoplay> < source src = "music.mp3" type = "audio/mpeg" > < source src = "music.ogg" type = "audio/ogg" > < source src = "music.wav" type = "audio/wav" > < p >If you can read this, your browser does not support the audio element.</ p > </ audio > |
The
controls
attribute provides the controls you see: play/pause and volume.
แสดงความคิดเห็น