Chocobozzz / PeerTube

ActivityPub-federated video streaming platform using P2P directly in your web browser
https://joinpeertube.org/
GNU Affero General Public License v3.0
13.01k stars 1.5k forks source link

Endpoint to get the video thumbnail #6147

Open bohwaz opened 9 months ago

bohwaz commented 9 months ago

Describe the problem to be solved

We want to be able to replace embed code for PeerTube videos with a static image + link to video, like we do with YouTube. This is done at server level.

This is because loading iframes, and external javascript and other ressources is slow.

It's currently not possible to get the video thumbnail without doing an API request.

Describe the solution you would like

There used to be a endpoint https://domain.tld/static/previews/:videoUUID as described here: https://framacolibri.org/t/thumbnail-of-video/8630

A good idea would be to re-instate it, and make it do a HTTP redirect, or serve directly, the video thumbnail image at a 720p size.

This is similar to what YouTube is doing:

https://img.youtube.com/vi/<insert-youtube-video-id-here>/maxresdefault.jpg
https://img.youtube.com/vi/<insert-youtube-video-id-here>/sddefault.jpg
https://img.youtube.com/vi/<insert-youtube-video-id-here>/mqdefault.jpg
https://img.youtube.com/vi/<insert-youtube-video-id-here>/hqdefault.jpg

Etc.

Mike35538 commented 9 months ago

It would be great also if we can fetch the thumbnail image with the short UUID and not just the the long UUID. The short UUID is so easy to find right in the video page URL. The video embeds can use the short UUID or long UUID. Having an easy way to pull the thumbnail image would be great, such as linking to peertubeinstance.com/lazy-static/previews/jH42P9xTk8BHHwX73DS5bV.jpg (domain/path/shortUUID.jpg). It's a little harder to find the video long UUID in order to use it in a link. It might be neat to have an option on the video page when you click Share, next to URL, QR-Code, Embed, have 'Image Link'. Or when you click URL, have the option under more customization 'Image Link' or 'Thumbnail Link'. That would make it easier to share the video in something like an email.