Enabling / Disabling Youtube Video Controls
The Youtube Player offers controls like play, pause, volume etc that can be disabled or enabled using the controls parameter. There are two parameters available that can be used :
- Value 1 (default case): Player controls are displayed.
- Value 0: Player controls are not displayed.
1. For Enabling Controls :
html
<!DOCTYPE html> < html lang = "en" > < head > < meta charset = "UTF-8" > < meta name = "viewport" content = "width=device-width, initial-scale=1.0" > < title >YouTube video embed with controls</ title > </ head > < body > < iframe width = "440" height = "372" src = "https://www.youtube.com/embed/il_t1WVLNxk/?controls=1" > </ iframe > </ body > </ html > |
Output :
2. For Disabling Controls
html
<!DOCTYPE html> < html lang = "en" > < head > < meta charset = "UTF-8" > < meta name = "viewport" content = "width=device-width, initial-scale=1.0" > < title >YouTube video embed without controls</ title > </ head > < body > < iframe width = "440" height = "372" src = "https://www.youtube.com/embed/il_t1WVLNxk/?controls=0" > </ iframe > </ body > </ html > |
Output :
HTML Adding Youtube videos
Adding a video to a webpage was a real challenge since one had to convert the videos to different formats to make them play in all browsers. Converting videos to different formats can be difficult and time-consuming.
Now, adding a video to a webpage has become as easy as copying and pasting and a very apt solution to add videos to a website is using Youtube. YouTube helps to host a video for a user so that they can be further embedded on web pages.
YouTube displays an id like “BGAk3_2zi8k“, whenever a video is saved or played. This ID is further used as a referral for the YouTube video to be embedded in the webpage.
Table of Content
- Steps to add a YouTube video on a Webpage
- Steps to get the Video ID of a YouTube video
- Adding Youtube video
- Enabling YouTube autoplay and muted feature
- Creating a YouTube playlist
- Enabling / Disabling Youtube controls
- Using object tag
- Using embed tag