A Better Method for Embedding YouTube Videos on your Website
It is easy to embed a YouTube video but you’ll be surprised to know how much extra weight that embedded YouTube video can add to your web pages. The browser has to download about half a Mb of extra JavaScript files (see screenshot) for rendering the YouTube video player alone. And these files are downloaded even if the visitor never plays the embedded video. The embedded video not only increases the byte size of your web pages but the browser has to make multiple HTTP requests to render the video player. This increases the overall loading time of your page thus affecting the page speed score . The other drawback with the default YouTube embed code is that it isn’t responsive . If people view your website on a mobile phone, the video player may not resize properly for the small screen. Embed YouTube Videos without Increasing Page Size Google+ uses a clever technique for embedding YouTube videos – it just embeds the thumbnail image of a YouTube video and the actual video player is lo...