Skip to content

Commit

Permalink
Merge pull request vb#11 from gg/issue-10-youtube-thumbnail-low-res-f…
Browse files Browse the repository at this point in the history
…allback

Use highest available resolution for YouTube thumbnail image
  • Loading branch information
vb authored Feb 4, 2018
2 parents db872a8 + bb83868 commit 7fa88b7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions dist/lazyframe.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lazyframe",
"version": "1.1.3",
"version": "1.1.4",
"description": "Dependency-free library for lazyloading iframes",
"main": "dist/lazyframe.min.js",
"jsnext:main": "src/lazyframe.js",
Expand Down
6 changes: 3 additions & 3 deletions src/lazyframe.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ const Lazyframe = () => {
youtube: {
title: (r) => r.items['0'].snippet.title,
thumbnail: (r) => {
let thumb = r.items["0"].snippet.thumbnails;
let url = thumb.maxres ? thumb.maxres.url : thumb.standard.url;
return url;
let thumbs = r.items["0"].snippet.thumbnails;
let thumb = thumbs.maxres || thumbs.standard || thumbs.high || thumbs.medium || thumbs.default;
return thumb.url;
}
},
vimeo: {
Expand Down

0 comments on commit 7fa88b7

Please sign in to comment.