What are the Added Features in HTML5?
Multimedia is made of different content forms like movies, animations, sounds, music, etc. and HTML5 has now come with additional multimedia features.
Multimedia Formats:
- Through its description such as extension and metadata, we can recognize the file type. .html or .htm is used to render HTML pages, whereas for CSS files, .css is used and .png, .gif, .jpg, etc are used for images and .xml for XML files.
- Multimedia files have extensions such as .mp3, .mp4, .wav, etc.
Browser Support:
Previously, only some set of fonts and colors were supported by the browsers, but they are not updated and don’t support different type of fonts, pictures, colors, etc. Different plug-ins are available to support multimedia files in the browser. Some of the plug-ins are as follows:
1. How to play videos in HTML?
Previously, aside from the Flash plug-in, there is no other way to display videos on a web page before the introduction of HTML5. But it was quite difficult to implement that. So, <video> tag is introduced in HTML5, which embeds a video on a web page without the need of Flash and thus reduces the difficulty.
Working:
- To add and adjust the controls of the video such as pause, play, and volume, we have the controls attribute.
- Adjusting the height and width of a video is a healthy practice and is implemented using height and width attributes.
- <source> tag is used to attach the link of a video to the web page.
View the code here.
2. How to play audio on the Web?
Even for the audio, Flash was the only solution before HTML5. To embed the audio into the web page <audio> tag is used to make the work of the web designer easier.
Working:
- To add and adjust the controls of the audio such as pause, play, and volume, we have the controls attribute. A text can be set to display if the browser doesn’t support this function.
- <source> tag is used to attach multiple audio files.
View the code here.
3. Video Formats:
Not all attributes of HTML5 are supported by every web browser. Some browsers have limitations in supporting HTML5 features. So, to support different versions of browser, some formats of videos are available in HTML5.
- It is a lengthy and time-consuming process to convert the video formats to allow them to play in all browsers. The easiest way is to play a YouTube video on your web page.
Playing a YouTube Video in HTML Page:
To add a YouTube video on a web page, these steps should be followed.
- Create a YouTube account and upload a video of your choice or existing videos can also be used.
- Remember the video id.
- <iframe> element has to be created on your web page.
- From the src attribute, attach the video URL.
- You can use height and width attributes to adjust the dimensions of the video.
Some of the other features can also be used. Follow the code here.