Mastering the Media: Complete HTML Course
Sobre a Aula

HTML YouTube Video Playback

If you want to share a YouTube video on your web page, follow these simple steps:

  • Video Upload to YouTube: First, upload your video to YouTube. Make sure it is set as public or unlisted, as private videos cannot be embedded.
  • Note the Video ID: Each YouTube video has a unique identifier called the ID. This ID is a unique sequence of characters at the end of the video URL. For example, in the URL “https://www.youtube.com/watch?v=YOUR_ID_HERE,” “YOUR_ID_HERE” is the video ID.
  • Define an Element on the Web Page: In the HTML code of your page, use the <iframe> element to embed the YouTube video. The <iframe> is a tag that allows the embedding of external content, such as videos.
  • Attributes of the <iframe> Element:
    • src (Source): The src attribute should point to the video URL on YouTube.
    • width and height: Specify the desired dimensions for the video player on your page.
  • Other Optional Parameters: You can add other parameters to the video URL to customize playback, such as starting the video at a specific point or hiding controls.
<iframe width="420" height="315"
src="https://www.youtube.com/embed/tgbNymZ7vqY">
</iframe>

By following these steps, you will be able to easily and effectively incorporate and display YouTube videos directly on your HTML pages.

Entrar na conversa
Rolar para cima