Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using PLYR for Youtube videos - poster image?

I am using Plyr (https://github.com/sampotts/plyr) to play Youtube videos inline. But i now want to add a poster to the player, so i can use a thumbnail for the video, before it plays.

Plyr supports this, but i can not get it to work. I am currently using Plyr in its most simple form:

Youtube video: <div data-type="youtube" data-video-id="bTqVqk7FSmY"></div>

Initialize Plyr: <script>plyr.setup();</script>

Thats it. How can i get the above snippet to show a poster for "/myposter.png"?

like image 210
brother Avatar asked Oct 15 '25 16:10

brother


1 Answers

Here is some example to achieve youtube video custom cover image:

player.poster = '../Images/landing/attendance/Admin Back.png';

example

or

var player = new Plyr('#vid'); setTimeout(() => { player.poster = 'http://ichef.bbci.co.uk/images/ic/640x360/p03hj5f7.jpg'; }, 500)

or

you can read this article A Better Method for Embedding YouTube Videos on your Website

like image 125
shamim khan Avatar answered Oct 17 '25 05:10

shamim khan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!