This is the code that runs https://bandolier.learnjsthehardway.com/ for you to review. It uses the https://git.learnjsthehardway.com/learn-javascript-the-hard-way/bandolier-template to create the documentation for the project.
https://bandolier.learnjsthehardway.com/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
1.3 KiB
25 lines
1.3 KiB
2 years ago
|
The [WebTorrent](https://webtorrent.io) 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](https://github.com/pobrn/mktorrent) 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.
|