ActivityPub is a W3C standard made for federation of decentralized servers. At first look, it's not really intended for what PeerTube tries to achieve, but it may be a rather good protocol to improve user to user interactions on different servers (such as comments).
It's a very interesting protocol but yes, not suitable for PeerTube because we only have very simple server to server interactions. For the comments I don't really know if we will federate them (it's a lot of work and not the main goal of PeerTube).
However there are some key concepts that I think we will use (followers/following, send messages only to followers...). I'll create a dedicated issue with the new federation architecture in some days/weeks.
After a discussion with @Gargron I'm reopening this issue. We should not have a private federation protocol.
Working on activitypub branch
Merged in develop!
For now, only Server-Server communication is implemented. Of course, the implementation is far from perfect and it misses some features (Block, Reject...) that I'll add later with dedicated issues (I'll create an "ActivityPub" label).
I discovered JSON-LD, ActivityStream and ActivityPub three weeks ago so there may be some inconsistencies. Of course they will be fixed progressively :)
PeerTube Case
Implementation
Group actor attributedTo a user actorRsaSignature2017attributedTo attributeTo conclude, PeerTube implements in a classic way the ActivityPub protocol. The only specificity is that the instance is an actor too and it automatically Announce all Create activities of its users. A PeerTube user cannot follow other users (there is no interface for this), but a Mastodon user could follow a specific PeerTube user, or a specific video channel of a user or directly the instance for example.
@cwebber Do not hesitate to comment/email/IRC me if you see potential issues with your future work on MediaGoblin!
@gargron I hope in the future Mastodon and video platforms will be able to communicate. I imagine something like:
This way, we have for example 4 different plateforms (Diaspora, PeerTube, Mastodon, MediaGoblin) that unify the video source and the comments! Better than Facebook/Twitter/YouTube no? :)
But there are plenty of other possibilities, very excited by the ActivityPub future :)
I'll let this issue opened a few days for discussion.
- Mastodon receive a Create/Add video activity
- Mastodon creates a status with an embed of the video
- Replies to this status are added to the video platforms as comments
@Chocobozzz Have you considered publishing a Create/Note activity alongside the Create/Video one? The contents could just be title of the video and link to its page. I could implement this sort of fallback on Mastodon's side, if you like, I am not sure which side should do this, but feels like you'll get more potential compatibility out of it?
Another small thing for better Mastodon integrations: Mastodon can look up OEmbed/OpenGraph data about a URL included in a status message. There is an OpenGraph tag that you'll find useful (which unfortunately carries a branded name): twitter:player - it's supposed to contain the URL of an embedded video player. For example, Twitch Clips uses that, and Mastodon displays those clips in the client just like other link previews. So you could have the PeerTube video player there. I'd rather avoid fetching PeerTube videos using our caching/camo-esque method because videos can get pretty big and it would strain the system, and this would be a good middle way.
Have you considered publishing a Create/Note activity alongside the Create/Video one? The contents could just be title of the video and link to its page. I could implement this sort of fallback on Mastodon's side, if you like, I am not sure which side should do this, but feels like you'll get more potential compatibility out of it?
Sure I can do this.
Another small thing for better Mastodon integrations: Mastodon can look up OEmbed/OpenGraph data about a URL included in a status message. There is an OpenGraph tag that you'll find useful (which unfortunately carries a branded name): twitter:player - it's supposed to contain the URL of an embedded video player. For example, Twitch Clips uses that, and Mastodon displays those clips in the client just like other link previews. So you could have the PeerTube video player there. I'd rather avoid fetching PeerTube videos using our caching/camo-esque method because videos can get pretty big and it would strain the system, and this would be a good middle way.
We already have the twitter:player tag, but it seems we have an error on Mastodon:
Refused to frame 'https://peertube.cpy.re/videos/embed/d2a5ec78-5f85-4090-8ec5-dc1102e022ea' because it violates the following Content Security Policy directive: "frame-src 'none'".
Example URL : https://mastodon.tetaneutral.net/@FF255/98935617310552785
Of course I did not want you to fetch the videos, just display the embed tag. But sending a Note should be a good solution! @cwebber, what do you think about that?
Refused to frame 'https://peertube.cpy.re/videos/embed/d2a5ec78-5f85-4090-8ec5-dc1102e022ea' because it violates the following Content Security Policy directive: "frame-src 'none'".
Seems like that instance has badly configured CSP headers. Our documentation does not recommend setting them! It wouldn't just be your player broken then, any embed would be broken on that instance.
My bad, thanks.
It seems to work well with another instance.
Have you considered publishing a Create/Note activity alongside the Create/Video one? The contents could just be title of the video and link to its page. I could implement this sort of fallback on Mastodon's side, if you like, I am not sure which side should do this, but feels like you'll get more potential compatibility out of it?
Sure I can do this.
While this technically works and may be the fastest path to interop with Mastodon, I wonder if it wouldn't be better for Mastodon to be able to display the Create/Video. Reason being is that in Pubstrate, Kroeg, and other applications which do understand Video as an independent object, now you'll see the same entry show up twice in your feed.
@Gargron how hard would it be to get Mastodon to start to understand Create/Video (and Image too?)
@cwebber Not hard, I think. We'll just create a text post with title + link. Natively supporting video or image attachments less likely though. Especially video. If you think this is better than implementing text posts in PeerTube, sure. I can see your reasoning.
Thanks @cwebber for the feedback.
@Gargron I'll fix the issues you pointed out in your MR. I just want to add that a comment system in PeerTube is not implemented yet, and it might take some weeks before I develop this feature. I'll try to be quick :)
After some feedbacks (thanks @puckipedia), I removed the video channel collection. A video channel is now a classic actor, that announces its videos. We just send classic video Create activities.
I updated my comment that described the implemention.
I made some tests with Mastodon, and everything seems to work (thanks @Gargron!):
Now I'll work on comments federation and improve the current implementation for a greater robustness. I think I can close this issue.
Thanks all :)
it seems that Mastodon does not handle remote likes?
I assure you that it does. Can you describe to me how you tried to do it?
From what I saw, Mastodon seems to reject the Like because the status account is not local: https://github.com/tootsuite/mastodon/blob/master/app/lib/activitypub/activity/like.rb#L7
But maybe I'm wrong.
Just wanted to point out that Nextcloud also uses ActivityPub for federation and might be a really interesting target for allowing people to seed videos or something like that.
Most helpful comment
Merged in develop!
For now, only Server-Server communication is implemented. Of course, the implementation is far from perfect and it misses some features (Block, Reject...) that I'll add later with dedicated issues (I'll create an "ActivityPub" label).
I discovered JSON-LD, ActivityStream and ActivityPub three weeks ago so there may be some inconsistencies. Of course they will be fixed progressively :)
PeerTube Case
Implementation
GroupactorattributedToa user actorRsaSignature2017attributedToattributeTo conclude, PeerTube implements in a classic way the ActivityPub protocol. The only specificity is that the instance is an actor too and it automatically
AnnounceallCreateactivities of its users. A PeerTube user cannot follow other users (there is no interface for this), but a Mastodon user could follow a specific PeerTube user, or a specific video channel of a user or directly the instance for example.@cwebber Do not hesitate to comment/email/IRC me if you see potential issues with your future work on MediaGoblin!
@gargron I hope in the future Mastodon and video platforms will be able to communicate. I imagine something like:
This way, we have for example 4 different plateforms (Diaspora, PeerTube, Mastodon, MediaGoblin) that unify the video source and the comments! Better than Facebook/Twitter/YouTube no? :)
But there are plenty of other possibilities, very excited by the ActivityPub future :)
I'll let this issue opened a few days for discussion.