/    Sign up×
Community /Pin to ProfileBookmark

Struggling with YouTube previews on my site. :(

Hi all,

I have set up a site which has YouTube videos embedded on it. The site ‘lazy loads’ the videos so they only load up when the user clicks on the video.

The problem I have is that a lot of the videos don’t show a proper preview of the video; they just show the grey video preview image with 3 dots. If I click these videos they play fine and after the video finishes the preview then is displayed.

The site is live so you can see what I mean – [U]here[/U]. (you will need to enter a date – note – a few videos don’t have permissions to play so just ignore them).

Any help greatly appreciated. Either with how to get this to work or another method of showing a preview or something.

Many many thanks.

to post a comment
HTML

2 Comments(s)

Copy linkTweet thisAlerts:
@SempervivumMar 16.2018 — This is discussed on stackoverflow:

https://stackoverflow.com/questions/2068344/how-do-i-get-a-youtube-video-thumbnail-from-the-youtube-api

According to this, the ssdefault image is not realiably available:
And additionally, the next two thumbnails may or may not exist. For HQ videos they exist.

Standard Definition Thumbnail (640x480 pixels)

https://i1.ytimg.com/vi/G0wGs3useV8/sddefault.jpg

Maximum Resolution Thumbnail (1920x1080 pixels)

https://i1.ytimg.com/vi/G0wGs3useV8/maxresdefault.jpg[/QUOTE]

However these should be available always:
there are seven thumbnails for every video. They are:

(Image size depends on video.)

Player Background Thumbnail (480x360 pixels)

https://i1.ytimg.com/vi/G0wGs3useV8/0.jpg

Start Thumbnail (120x90 pixels)

https://i1.ytimg.com/vi/G0wGs3useV8/1.jpg

Middle Thumbnail (120x90 pixels)

https://i1.ytimg.com/vi/G0wGs3useV8/2.jpg

End Thumbnail (120x90 pixels)

https://i1.ytimg.com/vi/G0wGs3useV8/3.jpg

High Quality Thumbnail (480x360 pixels)

https://i1.ytimg.com/vi/G0wGs3useV8/hqdefault.jpg

Medium Quality Thumbnail (320x180 pixels)

https://i1.ytimg.com/vi/G0wGs3useV8/mqdefault.jpg

Normal Quality Thumbnail (120x90 pixels)

https://i1.ytimg.com/vi/G0wGs3useV8/default.jpg[/QUOTE]
Copy linkTweet thisAlerts:
@ay76authorMar 16.2018 — Many many thanks Sempervivum

As you advised I changed ssdefault image to one of the ones which worked and it worked a treat.

Fantastic. have a great day!
×

Success!

Help @ay76 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...