Hacker News new | ask | show | jobs
by sroerick 132 days ago
This is pretty interesting!

I think serving video is a particularly interesting use of Webtorrent. I think it would be good if you could add this as a front end to basically make sites DDOS proof. So you host like a regular site, but with a JS front end that hosts the site P2P the more traffic there is.

2 comments

I think it is very difficult (and dangerous to the host) to serve user-uploaded videos at scale, particularly from a moderation standpoint. The problem is even worse if everyone is anonymous. There is a reason YouTube has such a monopoly on personal video hosting. Maybe developments in AI moderation will make it more palatable in the future.
The "host" is the user in this case. Every user that watches the video, shares the video. Given that discovery doesn't appear to be a part of this platform, any links would undoubtedly be shared "peer-to-peer" as well, so if you aren't looking at illegal things and don't have friends sending you illegal things to watch, it's perfectly safe.
webtorrent!
What I'm suggesting is more in the context of self hosting - a JS wrapper which would make it easy to host a video with plain HTML while preventing bandwith issues.
Hey, that's pretty much the project I've been thinking of doing for a while!

I really dislike the monopoly YouTube has on online video, but other options or self-hosting can become really expensive due to bandwidth (especially if your video suddenly goes viral). I think P2P (over WebRTC, for browser compatibility) has potential for creating a solution.

Roughly:

* You have a Website with some <video>s you want to share hosted somewhere—doesn't matter if it's dynamic, static, hosted on a CDN or a VPS, as long as it imports a few scripts and embellishes the <video> tag with a few details.

* Base case: you want to publish a video, you host the video. That means you host a server at home that is running the hosting software (maybe WebTorrent based, maybe something custom). As high-speed fiber Internet becomes more common, hosting video from a home network becomes more feasible (unless ISPs decide to cock-block it).

* A signaling server establishes a P2P connection (WebRTC datachannels) between a visitor of your Website and your video-hosting home server.

* If you have a fast enough Internet connection (100+ Mbps) and low traffic, I don't see why the base case shouldn't work (other than network connectivity problems due to complicated NATs and such). If you have a surge of simultaneous traffic, those that came earlier can offload pressure on the home server by seeding the video chunks they have already downloaded. Theoretically, infinite scalability without bandwidth or hardware bottlenecks (but likely coordination woes in practice).

But there's more!

Say there's another person on the Web hosting their videos in the same way. If I like their video, I can re-host it on my own home server and let their signaling server know about it. Now there are two "persistent" video servers hosting the video that a visitor can download from. If I trust this person, I can choose to automatically re-host all their past and future videos.

Moderation isn't a problem, because you explicitly choose which videos to re-host, or because you re-host (future) videos of people you trust.

The more people re-host videos, the better their availability, download speed, and latency if hosts are geographically distributed.

Further ideas of pooling signaling servers and home servers into networks to enable other possible niceties (though likely with a more substantial moderation burden) ...

I've tried a really basic proof of concept of the base case (across a few countries on a mobile network!), and it worked!

Currently, I'm looking to talk with anyone who is interested in any of this :)

There is PeerTube for video content.
I like Peertube a lot, and I didn't realize until just now that they had a form of P2P distributed distribution which uses WebRTC. But it would be great to be able to do that with a static site, without deploying a whole framework. Just a simple JS wrapper which could sit on top of a <video> element would be amazing