The HTML <audio> component is utilized to install sound substance in reports. It may hold a few audio sources, spoke to utilizing the src characteristic or the <source> component; the program will pick the most suitable one.
<audio> …. </audio>
Before HTML5, there was no standard for playing audio records on a site page.
Before HTML5, audio records must be played with a module (like flash). Then again, diverse programs backed distinctive modules.
HTML5 characterizes another component which details a standard approach to implant an audio record on a page: the audio component.
Here is the Syntax for AUDIO Element
Supported Browser
1
2
3
4
5
6
|
< audio controls> Â Â < source src = "Place your audio file here with full path" type = "audio/mpeg" /> Â Â < source src = "Place your audio file here with full path" type = "audio/ogg" /> </ audio > |
The control property includes <audio> controls, in the same way as play, stop, and volume.
You ought to likewise embed content substance inside the <audio> labels for programs that don’t help the <audio> component.
The <audio> component permits numerous <source> components. <source> components can connection to diverse audio documents. The program will utilize the initially perceived arrangement.
Below is complete syntax along with example
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
<!DOCTYPE html> < html > Â Â Â Â Â Â Â Â < head > Â Â Â Â Â Â Â Â Â < title >Title Name will go here</ title > Â Â Â Â </ head > Â Â Â Â Â Â Â Â < body > Â Â Â Â Â Â Â Â < audio controls> Â Â Â Â Â Â Â Â Â Â Â Â < source src = "media/simple_audio.mp3" type = "audio/mpeg" /> Â Â Â Â Â Â Â Â Â Â Â Â < source src = "media/simple_audio.ogg" type = "audio/ogg" /> Â Â Â Â Â Â <!-- This line will be called when you are running an old browser --> Â Â Â Â Â Â Â Â Â Â Â Â < p >Your file doesn't support the audio element</ p > Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â </ audio > Â Â Â Â Â Â Â Â Â Â Â Â </ body > Â Â Â Â </ html > |