YouTube video in HTML

The easiest way to play videos using HTML is to use YouTube.

If you're struggling with video formats, converting videos to different formats can be difficult and time-consuming. A simpler solution is to allow YouTube to play videos on your website. The easiest way to play videos using HTML is to use YouTube.

 

YouTube video ID

YouTube will display an ID (like tgbNymZ7vqY) when you save (or play) a video. You can use this ID and reference your video in your HTML code.

Play YouTube videos using HTML

To play your video on a website, do the following:

  1. Upload videos to YouTube
  2. Record the video ID.
  3. Identify an element

    Autoplay on YouTube + Mute

    You can have your video start playing automatically when a user visits your page by adding it autoplay=1to the YouTube URL. However, automatically starting videos can be annoying for your visitors!

    Note : In most cases, the Chromium browser does not allow autoplay. However, muted autoplay is always enabled.

    Add mute=1this autoplay=1so your video starts playing automatically (but muted).

    YouTube video autoplay + mute

     

    YouTube playlist

    The list of videos to play is separated by commas (in addition to the original URL).

    YouTube loop

    Add this feature loop=1so your video loops forever.

    1. Value 0 (default): The video will only play once.
    2. Value 1: The video will repeat (forever).

    Play YouTube videos repeatedly.

    YouTube video control

    Add this controls=0to prevent the control functions from being displayed in the video player.

    1. Value 0: Player control functions are not displayed.
    2. Value 1 (default): Functions that control the display of the player.

    YouTube video shows the control functions.

« PREV POST
READ NEXT »