Youtube


Youtube

Adding a video to a web page was a significant issue since you had to convert the videos to multiple formats to play in all browsers. It might be difficult and time-consuming to convert videos to various formats. Adding a video to a webpage is now as simple as copying and pasting, and Youtube is a great way to do so. Youtube assists users in hosting videos so that they can be embedded on other websites.

Youtube videos can be played on a webpage. Url of the video can be specified in the code. Attributes such as autoplay, loop, muted, etc can be added.

The following are the steps to embed a Youtube video on a website:

  • On YouTube, upload the video that you wish to embed on your website.
  • The video's video id should be copied.
  • For video definition, use the iframe, object, or 'embed' elements in your web page.
  • To point to the video's URL, use the src attribute.
  • The width and height attributes can be used to change the player's dimensions.

Activating the autoplay feature on YouTube:

When a visitor visits a page on Youtube, the autoplay feature can be utilised to automatically play a video.

There are two different sorts of parameters that can be applied:

  • Value 1: When the player loads, the video begins playing automatically.
  • Value 0 (default case): When the player loads, the video does not instantly start playing.

Creating a YouTube playlist:

To make a YouTube playlist, use the comma character to divide the list of videos to play.

The loop option is used to loop the number of times the videos are played back:

  • Value 1: The video will continue to loop indefinitely.
  • If the value is 0 (the default), the video will only play once.

Youtube control parameters:

Youtube controls can be activated or disabled using the controls parameter. The Youtube Player offers controls such as play, pause, volume, and others that can be disabled or enabled using the controls parameter.

There are two parameters that can be utilised:

  • Value 1 (the default): The player controls are shown.
  • Value 0: The player controls are hidden.

Example

<html> <body> <h1>Knowledge2life</h1> <iframe width="420" height="345" src="https://www.youtube.com/embed/tgbNymZ7vqY"> </iframe> </body> </html>

OUTPUT

Knowledge2life