
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Add Controls to an Audio Element in HTML5
HTML5 is a combination of technologies that the user can use for creating more robust and diverse websites and web apps that support multimedia, and communicate with software interfaces, among other things. In this article, we are going to see how we can add controls to audio in HTML5.
Syntax
<audio controls> <source> </audio>
The controls attribute of the </audio> tag can be used to specify the controls of the embedded audio. It allows the user to technically embed a music player directly in the webpage. The controls attribute adds functionalities such as play, pause, and volume.
Approach
We are going to make use of the aforementioned controls attribute to add controls to the audio.
Example
Step 1 ? First we will define the HTML code.
<!DOCTYPE html> <html> <head> <title>How to add controls to an audio in HTML5?</title> </head> <body> <h4>How to add controls to an audio in HTML5?</h4> </body> </html>
Step 2 ? Now we will add the audio tag.
<div> <audio controls> <source src="audio.wav"> </audio> </div>
Here is the complete code ?
<!DOCTYPE html> <html> <head> <title>How to add controls to an audio in HTML5?</title> </head> <body> <h4>How to add controls to an audio in HTML5?</h4> <div> <audio controls> <source src="audio.wav"> </audio> </div> </body> </html>
Conclusion
In this article, we got a clear understanding of the controls attribute of the </audio> tag. We saw how through the use of the controls attribute we could add controls to audio in a webpage in HTML5.