Wednesday, June 7, 2023
HomeWeb DevelopmentHTML 5 TutorialsWhat is audio Element in HTML 5 ?

What is audio Element in HTML 5 ?

[vc_custom_heading text=”Audio Element In HTML 5″ font_container=”tag:h1|text_align:left”]

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
html5 tutorial html5 tutorial html5 tutorial html5 tutorial html5 tutorial

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>

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -

Most Popular