Rewrite ui.setPoster to check that images arent broken or youtube fallback images. Only show poster element when valid

This commit is contained in:
Albin Larsson
2018-05-15 05:16:06 +02:00
parent 90d5b48845
commit 16c3a7d9e5
6 changed files with 42 additions and 21 deletions

View File

@ -99,11 +99,8 @@ const vimeo = {
// Get original image
url.pathname = `${url.pathname.split('_')[0]}.jpg`;
// Set attribute
player.media.setAttribute('poster', url.href);
// Update
ui.setPoster.call(player);
// Set and show poster
ui.setPoster.call(player, url.href);
});
// Setup instance