How to Embed Audio and Video in HTML? – GeeksforGeeks

HTML stands for HyperText Markup Language. It is used to design web pages using a markup speech. It is a combination of Hypertext and Markup language. HTML uses predefined tags and elements that tell the browser how to properly display the content on the screen. so, in this article, we will learn to embedded audio and television in HTML. In rate to insert multimedia files on vane pages, we already know to insert images in HTML .

How to embed audio in HTML?

To embed audio in HTML, we use the

Syntax:

Attributes of

Attribute Value Description
autoplay autoplay When the page is loaded. It specifies to play audio as soon as possible. 
controls controls It displays audio control. 
loop loop It will start the audio again when it is finished. 
muted muted When the page is loaded audio will be automatically muted. 
preload

auto metadata

none

It specifies how the author thinks the audio will be loaded when the page is ready. 
src URL It specifies the URL of the audio file. 

Example:  In this case, we will add an audio file to a web page. To add audio files on the web page, we need a notepad or another text editor program. Step 1: Open your notepad by searching notepad in your application list. Screenshot126 Step 2: Save a newfangled file with a valid name following with .html extension. step Step 3: Once the HTML file is saved, you can write HTML code inside this file. In this model, we have to embed an audio file so first gear keep ready an sound recording file and save the lapp directory where your HTML is saved. then we write hypertext markup language code as shown below code snip following by HTML code format .

HTML




< html > < head > < title >Page Titletitle> head> < body > < h2 >Click play button to play audioh2> < audio src = "./test.mp3" controls>audio> body> html>



Output: Note: Before adding an audio generator must be sure that the audio file is in the lapp directory and specified name .

How to embed video in HTML?

To embed video in HTML, we use the Syntax

Attributes of

Attribute Value Description
autoplay autoplay When the page is loaded. It specifies to play video as soon as possible. 
controls controls It displays video control such as play, pause, and stop.
loop loop It will start the video again when it is finished. 
muted muted When the page is loaded video will be automatically muted. 
poster URL It specifies an image will be shown until video play. 
preload auto
metadata
none
It specifies how the author thinks the video will be loaded when the page is ready. 
src URL It specifies the URL of the audio file. 
width pixels It specifies the width of the video area. The default value of width is ‘auto’.
height pixels It specifies the height of the video area. The default value of width is ‘auto’.

Example: In this example, we will add a video to our web page. To add television, we will use the

HTML




< html > < head > < title >Page Titletitle> head> < body > < h2 >Click play button to play videoh2> < video src = "./test.mp4" controls>video> body> html>



or you can use the following code :

HTML




< html > < head > < title >Page Titletitle> head> < body > < h2 >Click play button to play videoh2> < video controls>      < source src = "./test.mp4" > video> body> html>



Output: vid

My Personal Notes

arrow_drop_up

source : https://thefartiste.com
Category : Tech

About admin

I am the owner of the website thefartiste.com, my purpose is to bring all the most useful information to users.

Check Also

articlewriting1

Manage participants in a zoom meeting webinar

Call the people who attend the meet as follows Alternate host host Who scheduled the …

Leave a Reply

Your email address will not be published.