HTML Youtube

  • <object> element: It embed the object within the HTML documents and embed plug-ins such as Java applets, PDF readers, Flash Players etc in web pages.
Example:
<object width="100" height="100" data="bookmark.swf"></object>
  • <embed> element: It defines an embedded object within a HTML document.
Example:
<embed src="tutorialandexample.jpeg">

EMBED YOUTUBE

To embed video in HTML document YOUTUBE is the best option thus, HTML5 has provided that option. Syntax:
<iframe width="value1" height="value2"  

src="https://www.youtube.com/embed/video_id Attributes">  

</iframe>

ATTRIBUTES

  • Autoplay: It allows user to automatically plays the video when the site is visited
Value 0 (default): No Autoplay Value 1: Autoplay activated Syntax:
<iframe width="200" height="400"  

src="https://www.youtube.com/embed/video_id?autoplay=1">  

</iframe>
  • Playlist: It enables the list of video's to be played continuously by enabling.
Loop 0 (default): Video is played only once. Loop 1: Videos will be in loop. Syntax:
<iframe width="200" height="400"  

src="https://www.youtube.com/embed/video_id?playlist=video_id&loop=1">  

</iframe>
  • Controls: It allows user to view controls of the video like play/pause, volume etc.
Control 0: Player control does not display. Control 1 (default): Player Controls display. Syntax:
<iframe width="200" height="400"  

src="https://www.youtube.com/embed/video_id?controls=0">  

</iframe>



ADVERTISEMENT
ADVERTISEMENT