Techoceanhub logo

Implementing Video tag.

As we saw a <audio> tag in HTML. Video tag is also important as we can embed a video in HTML as well as audio.

The HTML Video element ( <video> ) embeds a media player which supports video playback into the document. You can use <video> for audio content as well.

Below is a code snippet which shows how to use <video> in html.

<!DOCTYPE html>
<html>
<body>
  <video autoplay>
     <source src="TechOceanhub.mp4" type="video/mp4">
 </video>
 <video autoplay>
     <source src="pp.mp4" type="video/mp4">
  </video>
</body>
</html>

You can add several <source>elements inside the <video> element. Each <source> element can link to different video files. The browser will use the first recognized format which is mp4, WebM, Ogg.

Different attributes of video tag:-

autoplay, controls, height, loop, muted, preload, src, width

autoplay: It specifies video will play as soon as it gets ready.

controls: It displays the video controls.

height: It sets the height of video player.

loop: Video will repeat itself over an over again.

muted: With this tag audio output will be muted.

preload: I is done by the user as it refreshes the page to reload the video.

src: I displays the source/location of a video.

width: It sets the width of a video player.

Feel free to read and comment below and try out this example.

Share:

Categories

Archives

Related Posts

Array Destructuring

Array Destructuring Array destructuring is a powerful syntax introduced in ES6 that allows you to unpack elements from an array

Read More »

Explore our Affiliated partner links

hostgator website plan

Hostgator

Best Website hosting plans & Best for 24/7 support.

hostinger webhosting plan

Hostinger

Reasonable website hosting packages for small business & 24/7 Email support

Elementor pro

Design Worpdress website quickly using Elementor Builder and AI

buy elementor website templates

Buy Elementor Website Template

Buy ready made Elementor Website Template from us & Get Free Elementor pro licence for 1 year .