1.3 KiB
The WebTorrent project provides a way for websites to share the bandwidth load with the users viewing content. It works on almost any content, but the first thing I I implemented is for Video.
This will most likely only work if you have your server on 127.0.0.1
since the torrent file is configured for that. Also, the default npm run dev
will run the simple tracker implementation found in services/tracker.js
. If you want to generate the torrents again then run:
sh scripts/mktorrents.sh sample.mp4
It uses the mktorrents to generate the torrent since it is faster. Be careful of the WebTorrent specific options I use in the services/mktorrents.sh
that are needed for WebTorrent to understand the torrent:
-p
-- Sets the private flag. This isn't needed for WebTorrent but is needed if you want to add extra protections to people accessing your content only after they log in.-l 15
-- Sets the piece length to 15.-w 127.0.0.1
-- Sets an initial web URL to use as a source. You should remove this if you want them to only go through the tracker and other users.
Download Link
If you want to let people download the video then add the download={ true }
property. This demo sets that option so you can see how it works.