Skip to content

How to set a thumbnail for custom video (e.g Youtube, Loom) #143

Discussion options

You must be logged in to vote

Yes, of course. You just need to define custom render.thumbnail function to render thumbnails for custom slides.

<Lightbox
  slides={[
    {
      type: "youtube",
      src: "https://www.youtube.com/embed/aqz-KE-bpKQ",
      thumbnail: "https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/images/BigBuckBunny.jpg",
      title: "Big Buck Bunny",
      width: 2160,
      height: 1215,
    },
  ]}
  plugins={[Thumbnails]}
  render={{
    slide: ({ slide, rect }) => // render custom slide
    thumbnail: ({ slide, ...rest }) =>
      slide.type === "youtube" ? (
        <ImageSlide slide={{ src: slide.thumbnail }} {...rest} />
      ) : undefined
  }}
  // ...
/>

https://codesand…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by gagandeepgill
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants