Media and iframes

In this section, we will learn the following HTML tags. 

  • audio
  • video
  • iframe

Audio

HTML5 helps in embedding audio in the webpage, before version 5 of HTML it was not possible to do so without third-party plugin flash.  <audio> tag is a container tag containing source of video inside <source> tag. Multiple source file can be provided with the same audio to give choice to the browser. MP3, OGG and WAV are supported format for audio files. 

Video

Similar to audio, the video was also requiring third-party plugin flash to embed in the webpage before HTML5.  <video> is a container tag containing <source> tag inside it. Multiple source tags are provided to allow browser choose a more compatible version of the video.

 Video tag is accepting height and width attribute to define the size of the display in the webpage.  The autoplay attribute helps in start video on page load without manual action. The controls attribute provides video control options.  Supported video formats are MP4, OGG, WebM. 

iframe

The iframe is used to display another webpage inside a webpage. <iframe> is the HTML tag accepting src attribute which holds URL of the webpage to be framed.  It is always recommended to pass height and width attribute along with the iframe for proper display on a webpage.  Some websites are having iframe breaker to avaid their page loaded in iframe.
YouTube videos and Google Maps are embeded in a webpage using this HTML tag.