diff options
author | Sam Potts <sam@potts.es> | 2020-10-19 22:41:09 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-19 22:41:09 +1100 |
commit | 5d2c288721bd8d7be77352cf1f8f81c2592aeed5 (patch) | |
tree | 26b6c0cf9302fec6a90de12b10d4841ebebc77ac /src/js/plugins/vimeo.js | |
parent | 30989e4dbc6acb9d1caf4a83af4d6cd12d2548db (diff) | |
parent | e646207ed6156bd4375efa290778586742c80afa (diff) | |
download | plyr-5d2c288721bd8d7be77352cf1f8f81c2592aeed5.tar.lz plyr-5d2c288721bd8d7be77352cf1f8f81c2592aeed5.tar.xz plyr-5d2c288721bd8d7be77352cf1f8f81c2592aeed5.zip |
Merge pull request #1961 from Benny739/master
fixed #1181 vimeo oembed api
Diffstat (limited to 'src/js/plugins/vimeo.js')
-rw-r--r-- | src/js/plugins/vimeo.js | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/src/js/plugins/vimeo.js b/src/js/plugins/vimeo.js index d098fe96..33c327d7 100644 --- a/src/js/plugins/vimeo.js +++ b/src/js/plugins/vimeo.js @@ -121,21 +121,15 @@ const vimeo = { wrapper.appendChild(iframe); player.media = replaceElement(wrapper, player.media); } - + // Get poster image - fetch(format(player.config.urls.vimeo.api, id), 'json').then(response => { - if (is.empty(response)) { + fetch(format(player.config.urls.vimeo.api, src)).then(response => { + if (is.empty(response) || !response.thumbnail_url) { return; } - - // Get the URL for thumbnail - const url = new URL(response[0].thumbnail_large); - - // Get original image - url.pathname = `${url.pathname.split('_')[0]}.jpg`; - + // Set and show poster - ui.setPoster.call(player, url.href).catch(() => {}); + ui.setPoster.call(player, response.thumbnail_url).catch(() => { }); }); // Setup instance |