cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv headernumbered-list123split-screen
user profile image

We are going to pull and play a YouTube video, not when the page loads, but when the user asks to do so. This method is popularly known as lazy loading–it will minimise the HTTP requests on initial page load, and ultimately improve the page’s performance.

Read the full tutorial.

This Pen is a fork of Thoriq Firdaus's Pen Youtube Lazy Loading.

Comments

  1. Thank you for that, dudes ! It makes the job quite perfectly !

    2 questions then, if I may :

    • autoplay=1 does not to work on iPads & iphones (means users have to click twice to launch the video) Is this fixable & how ?
    • in some case I find myself with videos that has no thumbnails like /sddefault.jpg. How would it be possible, in such case, to fill in 'var source' with an alternative img, home hosted ?

    Thanks in advance ;)

Leave a Comment Markdown supported. Click @usernames to add to comment.

You must be logged in to comment.
Loading...
Loading...