Video and Audio in HTML

Photo by One Day on Unsplash

Video and Audio in HTML

Table of contents

The first influx of online videos and audio was made possible by proprietary plugin-based technologies like Flash and Silverlight. Both of these had security and accessibility issues, and are now obsolete, in favor of native HTML solutions <video> and <audio> elements were introduced

we can embed video and audio by just using these tags.

Video Tag:

By using this tag we can embed any video in your web page. There are some attributes that can help your video to be visible on your website

<video src="../video/A broker works with a cryptocurrency candlestick chart.mp4" autoplay muted controls height="500" width="700">stock broker </video>

In the above code the <src> is an attribute without this attribute there will be no video source. we add video source in it that will be in local files or URL. then there are two more attributes there

height and width with the help of these attributes the video source will visible on your web page with given dimensions.

these are some attributes for video tag

Formats supported for audio: MP4, WEBM, and OGG.

Audio Tag:

by using this <audio> tag we can embed audio files with controls on your website

we can add download button to download the audio file to your local files.

By using anchor tag we can download the audio file. in anchor tag we use audio source then name it as download

whenever we click the download link the audio source will be downloaded to your local files.

here are some attributes

Formats supported for audio: MP3, WAV, and OGG.

The reason why we use different formats is:

For whatever reason, if the browser is unable to load the mp3 file, it will then go through the list of other source paths and reload the next and play.