contentdb icon indicating copy to clipboard operation
contentdb copied to clipboard

Peertube support

Open fgaz opened this issue 7 months ago • 2 comments

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-known or /api
  • The thumbnail url can't be trivially derived from the video id. It requires a call to /api/v1/videos/{id} to get thumbnailPath, 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/

fgaz avatar May 20 '25 10:05 fgaz

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

rubenwardy avatar Jun 03 '25 19:06 rubenwardy

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&amp;auto_play=1"
  frameborder="0" allowfullscreen=""
  sandbox="allow-scripts allow-same-origin allow-popups allow-popups-to-escape-sandbox allow-forms"
>
</iframe>

fgaz avatar Jul 19 '25 14:07 fgaz