Today day-7 class learned.Audio and YouTube video playing
Html video
The HTML <video>
element is used to show a video on a web page.
<video width="320" height="240" controls>
<source src="movie.mp4" type="video/mp4">
<source src="movie.ogg" type="video/ogg">
Your browser does not support the video tag.
</video>
How it Works
The controls attribute adds video controls, like play, pause, and volume.
It is a good idea to always include width and height attributes. If height and width are not set, the page might flicker while the video loads.
The
The text between the tags will only be displayed in browsers that do not support the
HTML Audio
The controls attribute adds audio controls, like play, pause, and volume.The <source>
element allows you to specify alternative audio files which the browser may choose from. The browser will use the first recognized format.
The text between the <audio>
and </audio>
tags will only be displayed in browsers that do not support the <audio>
element.To start an audio file automatically, use the autoplay attribute.Add muted after autoplay to let your audio file start playing automatically
`<audio controls autoplay muted>
<source src="horse.ogg" type="audio/ogg">
<source src="horse.mp3" type="audio/mpeg">
</audio>`
Playing a YouTube Video in HTML
Define an <iframe>
element in your web page
Let the src attribute point to the video URL
Use the width and height attributes to specify the dimension of the player.Add any other youtube URL in sce attributes Add mute=1 after autoplay=1 to let your video start playing automatically
`<iframe width="420" height="315"
src="https://www.youtube.com/embed/tgbNymZ7vqY?autoplay=1&mute=1">
</iframe>`
Top comments (0)
Some comments may only be visible to logged-in visitors. Sign in to view all comments.