Peertube integration with Lemmy
from Agosagror@sh.itjust.works to fediverse@lemmy.world on 20 Dec 22:20
https://sh.itjust.works/post/29792636

cross-posted from: sh.itjust.works/post/29792601

Hi,

I want to take a little slice of the time I spend watching videos on Youtube and give that slice over to Peertube. I don’t mean all of it, given I watch far too much Youtube, but a slither which I hope to grow as Peertube hopefully matures.

As such I don’t want to have to make a Peertube account, I want to get Peertube videos straight into my Lemmy feed. To an extent I’ve already done this, but the videos are just links to the Peertube instance and aren’t embedded.

And the other issue is that the comments section is, well, a mess. Lemmy hardly syncs the comments and only does so for comments from other Lemmy instances and the videos Peertube instance.

The first issue feels relatively solvable, Peertube embeds. The second feels like something to do with how activity pub works and as such I have no idea.

I do feel that Peertube is a platform that needs the most support from other platforms in the form of integration, as it’s got a very uphill battle ahead of it, and it’s the first one I’ve noticed. but stronger integration between fediverse platforms on Lemmy would doubtless benefit not just those platform but Lemmy as well.

I thought I would post this and get peoples thoughts

#fediverse

threaded - newest

ptz@dubvee.org on 20 Dec 22:54 next collapse

Tesseract has had PeerTube embed support for well over a year now. There’s nothing stopping other UIs from supporting them 🤷🏻‍♂️

…dubvee.org/…/veronicaexplains@tinkerbetter.tube

They work great when sharing a PeerTube link in Lemmy, but I’ve had issues where subscribing to a Peertube channel either doesn’t pull anything or only does an initial pull of a few videos. New posts don’t seem to come in. That’s some Lemmy to/from Peertube federation trouble. However, on the PT posts that do come in, i can upvote/downvote and comment on them.

m_f@midwest.social on 20 Dec 23:52 collapse

Neat! Since it’s come up a lot in !loops@midwest.social, are there any plans on having loops embed as well? Do you know if that’s something the Lemmy devs would support once for everyone, or would every client have to add support for it?

ptz@dubvee.org on 21 Dec 00:00 collapse

I’m 100% planning on integrating loops, but there’s a problem that needs solved. The embed data returned when querying a loops link doesn’t include an embed video URL (which is how most but not all of the embed media is rendered). There’s also nothing in the metadata for a loops link that can derive the video URL (which is a trick I use for some other embed media or where I don’t want the user to have to use the special “share” links).

I’ve emailed the Loops team asking if they would add the oc:video meta tag in the header info, but I have not heard back.

If that doesn’t pan out, I have tested hotlinking the video URL, and I can get that to render.

Ex: dubvee.org/post/2293134

Since that works, and if all else fails, I can add a server-side API endpoint to Tesseract that will fetch the loops page, parse it for the video tag, and essentially scrape the page to get the video link. That’s messy, but I can make it work (though I’d prefer not to).

m_f@midwest.social on 21 Dec 00:29 collapse

Cool, that’s good to hear. The good news is that if it comes down to parsing the HTML, that’s pretty straightforward. I’ve been poking at it, and it’s nice and semantic (gets turned into a regular <video> element by JS:

<video-player
    poster-src="https://loopsusercontent.com/videos/85319640150794240/96649242004583579/8yjZniSLk64lxIPomBfUzr5SwMXRKGWXyHpTLruN.jpg"
    video-src="https://loopsusercontent.com/videos/85319640150794240/96649242004583579/8yjZniSLk64lxIPomBfUzr5SwMXRKGWXyHpTLruN.720p.mp4"
    username="thomasdorr"
    profile-picture="https://loopsusercontent.com/avatars/85319640150794240/v0.jpg"
    caption="Snowing in #DuluthMN"
    tags=""
    likes="8"
    comments="1"
    />

And hopefully it’ll get open source soon or have some way of filing bugs/feature requests. I saw that the dev created joinloops.org and is planning on putting a roadmap there soon.

ptz@dubvee.org on 21 Dec 01:48 collapse

I just put together a basic API endpoint and am successfully scraping the video URLs. Have a very rough integration working in dev, so I think this is going to be supported soon :)

Edit: Hell yeah!

<img alt="" src="https://dubvee.org/pictrs/image/bed2f440-15cf-42c5-84a2-d3becc322637.webp">

m_f@midwest.social on 21 Dec 01:56 collapse

Wow, that was quick, amazing! 🥳

ptz@dubvee.org on 21 Dec 02:33 collapse

Still fine tuning it, but I think it’s gonna make it into the next release 🎉

m_f@midwest.social on 21 Dec 03:07 collapse

Hell yeah, it’ll be nice to have an answer other than “🤷” for people that want embedded loops 👍

mesamunefire@lemmy.world on 20 Dec 23:20 next collapse

It used to work to subscribe, but for some reason around 7 months ago, direct links dont seem to federate anymore:

lemmy.world/…/thelinuxexperiment_channel@tilvids.…

lemmy.ml/…/thelinuxexperiment_channel@tilvids.com…

VS tilvids.com/a/thelinuxexperiment/videos

as an example. Im not sure if this is instance specific.

It works outside of lemmy. For example piefed:

piefed.social/…/thelinuxexperiment_channel@tilvid…

works really well.

Fitik@fedia.io on 20 Dec 23:55 collapse

Seems to work fine on MBin as well - https://fedia.io/m/thelinuxexperiment_channel@tilvids.com

mesamunefire@lemmy.world on 20 Dec 23:59 collapse

Yeah the more im looking at this, it seems to be lemmy in particular that is having issues. I was able to get to the channel on mastodon/GotoSocial/piefed/other federated services as well. No issues.

andrew_s@piefed.social on 21 Dec 00:00 next collapse

As Admiral Pat mentions, embeds are easy enough. I don't know how Tesseract does it, but a low-tech solution is to just replace 'watch' in the URL with 'embed' and stick it in a iframe. From Lemmy's GitHub, it looks like there's been work on this, but I'm not familiar enough with it to know whether it's for future versions that haven't been released yet.

New videos used to come in to Lemmy as expected. There's been some regression that stopped it. It's possible to bring them in manually though (by searching for the URL), and - like with embeds - it's possible that it's been fixed but not yet released.

PT's videos channels are ActivityPub Group types like Lemmy's communities, but it doesn't handle federation the same way. It does it in a way that's more compatible with Mastodon. Lemmy's communities Announce everything they receive (posts, comments, votes, etc) and so if you receive that Announce, then as long as you trust the community, you can trust that the contents haven't been changed and process it. PT's video channels only Announce new posts (so on Mastodon, it appears as if the channel has Boosted content by the channel owner), but for everything else, it's a combination of sending out a 'post update' (which is essentially an invitation to query the outboxes it provides for votes and comments), and just flinging out the comment as is, without the HTTP signature. If you get that comment, then you can either use the LD signature that Mastodon includes to verify, or you can look at the ID, and fetch it from it's source. As such, Lemmy's federation model is mostly Push-based, whereas PeerTube's is a bit of Push, and a lot more Pull.

ademir@lemmy.eco.br on 21 Dec 19:09 collapse

That’s an old request and from both sides there were works to get it working. No idea why it isn’t working yet.