contentdb
contentdb copied to clipboard
Peertube support
Problem
I'd like to set video urls to peertube videos and get the same functionality as youtube:
- thumbnail
- embed
Solutions
Implementing this isn't as straightforward as youtube.
- Requires detecting peertube instances, either through a hardcoded list or by querying
/.well-knownor/api - The thumbnail url can't be trivially derived from the video id. It requires a call to
/api/v1/videos/{id}to getthumbnailPath, which might have to be cached in the database to avoid calling the peertube API on every request. - There might be security implications stemming from embedding arbitrary pages. An instance whitelist might be safer.
Alternatives
...don't
Additional context
Package with a peertube video: https://content.luanti.org/packages/fgaz/last_login_signs/
Maybe I could show the og:image of linked pages. I don't really want to add support for embedding lots of different video providers
I looked into opengraph video embeds, and it looks like it's safer than I thought. Mastodon for example embeds any video by putting twitter:player/og:video/og:video:url in an iframe like this
<iframe
width="560" height="315"
src="https://video.hardlimit.com/videos/embed/jNYwGM2QCqNCvykBmfBs1M?autoplay=1&auto_play=1"
frameborder="0" allowfullscreen=""
sandbox="allow-scripts allow-same-origin allow-popups allow-popups-to-escape-sandbox allow-forms"
>
</iframe>