Comments (7)
Putting a conditional around the backgroundImage seems simplest, no?
if (!this.style.backgroundImage){
this.posterUrl = `https://i.ytimg.com/vi/${this.videoId}/hqdefault.jpg`;
LiteYTEmbed.addPrefetch('preload', this.posterUrl, 'image');
this.style.backgroundImage = `url("${this.posterUrl}")`;
}
If there's already a background image, leave it alone...
from lite-youtube-embed.
This feels like a duplicate to #54 which aims to discuss a solution that would allow for this as well.
Currently it is not supported since we automatically pull the cover image generated by YouTube. To be honest, I'd urge against supporting this directly. As it could be very easily mis-used to trick people into viewing video's they don't expect.
What exactly is your use-case for wanting a fully custom cover image?
from lite-youtube-embed.
shipped in 0.2.0.
i added docs and a demo, too: https://github.com/paulirish/lite-youtube-embed#custom-poster-image
from lite-youtube-embed.
Good question. The thumbnail provided by YouTube is low quality. While the cover image itself where I'm using this will be the same, the low resolution of the image makes for a blurry image and would prefer to implement an image of higher resolution.
To be honest, I'd urge against supporting this directly. As it could be very easily mis-used to trick people into viewing video's they don't expect.
I understand but don't think that's something you can control as that's already possible via YouTube thumbnail. I also don't think it's something we could/should police.
from lite-youtube-embed.
Same issue here. YouTube thumbnails are of low quality. I'm currently looking for another library that does what lite-youtube does, but without the image limitations/being unable to lazyload images out of the box.
from lite-youtube-embed.
The background image in the "pro usage" section of the readme should be your cover image?
https://github.com/paulirish/lite-youtube-embed#pro-usage
from lite-youtube-embed.
+1 for IORoot's suggestion, I've just been bitten by this on a project where we let CMS users add custom cover images to videos (often higher quality ones than provided by YouTube) and this component is overwriting the custom image we are setting as a background image on the component.
from lite-youtube-embed.
Related Issues (20)
- Failed to execute 'postMessage' HOT 2
- Type declarations
- On mobile, double click is neccesary HOT 8
- Display a title on the video thumbnail HOT 2
- Graceful degradation if YT API breaks
- NPM version is outdated HOT 1
- Custom Width and Height for Youtube shorts HOT 6
- Will it be counted as views on YouTube? HOT 2
- sometime no image loaded HOT 1
- does not work on mobile HOT 2
- Early click on Progressively Enhanced version directs user to youtube.com HOT 1
- A11Y: Why `a.lty-playbtn` instead of `button`? HOT 2
- Start and end params not working when using js-api
- I am using lite youtube embed and I want to get onStateChange player.getPlayerState():
- How can we keep the lower quality preview?
- Could we get a more noob friendly guide for Pro-usage? 😇
- Deprecated navigator.vendor HOT 1
- v0.3.2 Release HOT 1
- Yield on LiteYTEmbed click listener to reduce INP impact HOT 3
- Offering the class in ESM format
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lite-youtube-embed.