Can someone help me with how peertube P2P works? I can understand how ActivityPub is used for all the "social" parts but I'm a bit confused about the actual video player.
Redundancy:
I have my own instance and I made a redundancy of a video from the blender instance. if I watch the video on my instance I see 2 peers, my instance and the blender one. I can seen both in Firefox dev tools.
If I watch the same video on the blender instance I see 7 peers, the blender instance, mine, and others. why are these extra peers not showing on my instance? do I need to do something? If I watch the video on one of these other instances mine does show up in the their peers list.
I also made a video from framatube redundant but my instance doesn't appear as a peer on framatube.
Client P2P:
If I watch a video does my browser share It over P2P? if so what is the point of this? it seems to lose the video as soon as I leave the page so this functionality seems a bit useless to me.
EDIT: Answered in comments.
BitTorrent:
If I download a video I get the option of a BitTorrent torrent. If I seed this torrent can it be leeched by web clients? I tried and It doesn't show up in the peer list. What's the point of running a full BitTorrent tracker if it doesn't work with the main P2P system?
EDIT: BitTorrent is incompatible with webtorrent that peertube uses. Peertube also uses HLS instead of webtorrent and behaves a bit different (you can't seed it with a webtorrent client).
Peer discovery:
As I said in 1 and 2 how does the player actually find peers? Is there something like DHT or a tracker built in to peertube? if it's an internal tracker how does the tracker find peers?
If I watch a video does my browser share It over P2P? if so what is the point of this? it seems to lose the video as soon as I leave the page so this functionality seems a bit useless to me.
This is the main feature of Peertube. It allows many people to watch the same video simultaneously without totally overwhelming and DDos-ing the server that hosts the video.
Would it not make more sense if your instance downloaded and redistributed the torrent? then you could keep seeding after the tab closed. it also wouldn't leak your IP then.
What about peer discovery? I opened that webtorrent website in two browsers and they didn't peer, is that demo real?
Only partially true nowadays. WebTorrents is a format that PeerTube can use, but is deprecated and non-default in newer releases. Instead, the preferred method now is HLS, which I think is a fair bit more reliable.
A simple way to understand it: PeerTube itself doesn't actually federate videos - instead, it's a shared catalogue where metadata representing video entries are the things that get shared from server to server, as ActivityPub Objects. This makes federation fairly lightweight, because instances aren't just passing copies of huge files back and forth on a network.
The actual video itself is hosted on the parent instance, or at the very least, in an Object Storage Layer (basically a CDN) that the server is integrated with. When a video is uploaded, it gets re-encoded in either one or two different formats - Webtorrent, or HLS. When people watch the video, it becomes peered between videos, where people with more of a downloaded video helping people with less of a downloaded video. The methods, I think, depend on which encoding format was used - HLS largely relies on "Playlists" that put together a video broken into several files, for seamless playback, Webtorrent I think works a little more like a traditional torrent does, with seeders.
All good questions! I’d also just like to know what a few of the “best” instances are to watch videos on. I don’t get discovery. They all have weird names.