Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React Player Thumbnail

i am using react-player for playing videos. Not sure if there are any better options, but this seems to do the job. The only issue i have is, that i need to get thumbnails for the videos. Any idea how i would go around it ?

If you know about some better option for playing videos in React web app with supported thumbnails, that would be also great.

<ReactPlayer                                                    
 className="videoFrame"
 url={url}
 playing
 controls
/>

Thanks

Edit: I ended up using the video itself as thumbnail and blocking all mouse events over it. Then use parent div as button. In case of youtube i replace the video with thumbnail provided by youtube ( https://img.youtube.com ), because of the big play button over video. Most of other players dont have it.

like image 688
CosmicSeizure Avatar asked Oct 16 '18 11:10

CosmicSeizure


People also ask

What is React player?

ReactPlayer. A React component for playing a variety of URLs, including file paths, YouTube, Facebook, Twitch, SoundCloud, Streamable, Vimeo, Wistia, Mixcloud, and DailyMotion.

Does React player support HLS?

react-hls-player uses hls. js under the hood. You can get the HLS player instance by using ref.

How do I show a video in React?

To play video in React, you need to use the HTML video element, specify a source of the video and its type. Along with these required attributes, you can provide additional properties to customize the video player.


1 Answers

Use the light prop to supply an image URL to the player.

<ReactPlayer                                                    
 className="videoFrame"
 url={url}
 light="http://placekitten.com/200/300"
 playing
 controls
/>
like image 195
RubbelDieKatz Avatar answered Sep 27 '22 15:09

RubbelDieKatz