Categories: Social Media

How to embed YouTube Videos more efficiently?

YouTube videos are embedded to web pages for various reasons and when you embed these videos through the most usual method that makes use of iFrame Tags, then have you ever known these videos add extra pounds to your web page? What happens when your web pages get into an overloaded size, is very well known by many. You get the negative impact on the SEO front. Also, the page loading time of your site gets increased. If you wonder why, the reason is a video from YouTube in your web pages makes 12 HTTP requests and downloads 400 KB data. Also, the web page has to download the resources of 400 KB and these are needed to be downloaded even if the visitors do not want to watch the video. Here is how to embed YouTube videos more efficiently.

The Cons:

There are two reasons why this is not comfortable for the owner for the web page and the visitor as well:

  1. The web page has to download 0.4 MB in addition
  2. The visitor’s system has to make multiple HTTP requests

How to embed the videos efficiently?

You can find the solution in Google Plus. This reduces the loading time that gets increased because of the embedded YouTube video. The entire video is not shown in the web page. Instead the visitors get to see the thumbnail of the YouTube video and also there is an icon to play the video, which pictures the video has to be played from the thumbnail. A standard video player can be seen once the play button is hit by the visitor and the thumbnail is replaced by it. In this case, only if the visitor likes to watch the video, the extra resources of CSS, java script worth of 400 KB are downloaded. Otherwise, the web page does not require these additional 0.4 MB.

The Code:

The embed code for the YouTube videos need to include

  1. Height of the player
  2. Width
  3. The unique YouTube Video ID

The height and width are to be specified in pixels. In the regular code all you need to specify are these information that are corresponding to your web page. With this little or no effort, you can see that the size of your web page is greatly reduced. You can see the difference of 300 KB in minimum.

For people who have site that has large number of visitors per day and if the traffic of the site is high, you need to do the following. You need to make a copy of the minified youtube.js from googlecode.com. Then you need to host this copy on your server.

Swasti Pujari

Swasti Pujari is a versatile Engineer, blogger, content writer, and Social Media Enthusiast. With a passion for technology and creativity, she has devoted her career to solving engineering challenges and crafting engaging content. Her online presence is a strategic platform for connecting with people and sharing insights. Swasti's unique blend of technical expertise and creative expression has made her a key figure in her field. Her mantra for success is continuous learning and happiness in her work, reflecting her innovative approach to both engineering and writing.

Share
Published by
Swasti Pujari

Recent Posts

Top 10 Sitcoms of the 2010s That You Need to Watch

Everyone loves binging a good old sitcom from time to time. The usual favourites such…

5 months ago

Top 15 Classics for Kids That Will Keep Your Child Occupied

According to recent psychological studies, indulging in too much screentime has resulted in decreased attention…

6 months ago

Top 15 Feel Good Movies To Free Your Mind of Stress

Feel good movies have the power to lift your mood no matter how sad you…

6 months ago

How to Conduct an SEO Audit for Your Joomla Website

Greetings, digital navigators! 🌐 Embarking on the journey of building a website with Joomla? Kudos!…

6 months ago

Top 10 Movies Like Hera Pheri That Are Simply Hilarious

Movies like Hera Pheri are not that hard to find. Hera Pheri is no doubt…

7 months ago

Top 15 Mythological Movies That Are Far Better Than Adipurush

Mythological movies are comforting to watch because they remind us of the stories that our…

8 months ago