Giter VIP home page Giter VIP logo

Comments (7)

IORoot avatar IORoot commented on August 11, 2024 4

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.

Garbee avatar Garbee commented on August 11, 2024 1

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.

paulirish avatar paulirish commented on August 11, 2024 1

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.

michaeltieso avatar michaeltieso commented on August 11, 2024

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.

Fiorinol avatar Fiorinol commented on August 11, 2024

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.

davidsneighbour avatar davidsneighbour commented on August 11, 2024

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.

philwolstenholme avatar philwolstenholme commented on August 11, 2024

+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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.