Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to pause embedded youtube video on the last frame?

When playing embedded youtube videos, I don't want to display a poor resolution thumbnail when completed. Instead I'd like to have a high-resolution image of the last frame. Is this possible?

Either I can pause on the last frame or maybe there's a way to create a high-resolution thumbnail of the last frame?

like image 937
at. Avatar asked Nov 03 '22 07:11

at.


1 Answers

You can use the YouTube Player API to detect when playback has ended, and at that point do some DOM manipulation to swap out the player and swap in an img tag pointing to one of the video's thumbnails. There normally would not be a thumbnail for the last frame in the video, though, so you would have to choose a different thumbnail.

If you just want to disable the related videos that are shown when a video ends, you can use the rel=0 player parameter, but that will leave you with a black screen.

like image 166
Jeff Posnick Avatar answered Nov 17 '22 04:11

Jeff Posnick