Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?


Failed to load latest commit information.
Latest commit message
Commit time


Build Status


Simple proof-of-concept for a live streaming solution based on webtorrent. Video player courtesy of hls.js.


Yes please ! Live demo with sintel at

Run it yourself

# Install
npm i -g live-torrent

# Start with example live-feed
live-torrent -v -u

# ... or Create a Webtorrent enabled feed from a folder with .ts files
live-torrent -v -l -f feed

# Open browser at


I have a regular feed already

live-torrent can convert your feed into a webtorrent enabled feed. The first example command above will download the feed at, and generate a webtorrent-enabled HLS feed from it. Just open your web-browser at to have a look.

I want to create a feed !

No problem - the second example up here will generate a feed for the directory feed, how simple ! New chunks added to the directory will be pushed to the manifest.

Have a look in the feed directory for instructions on how to generate a sample feed from a mp4 file.

How to implement on a website ?

Just host the script, serviceworker and videoplayer on your site and you're good to go. Also, there are some limitations to the use of SW ; the site hosting the videoplayer needs to be served from HTTPS, and serviceworker should be located at the root of the domain (e.g. Also feel free to open an issue if something's acting weird :)

Do I need CORS ?

Yes ! But it's easy to enable. It's enabled by default using the "create from a folder" option.

How is it working ?

TLDR(ish); A server script parses the video manifest and generates torrent magnet links from the video chunks. The magnets are pushed on the manifest.

Now on the browser side, the videoplayer downloads the manifest, the serviceworker hijacks the request, extracts the magnet links, and tries to download the chunks via webtorrent. If it fails, it falls back to the manifest url (and then seed), otherwise, well p2p - yay !

Basically 3 different pieces are needed :

  1. a server script to make a HLS manifest with magnet links in it
  2. serviceworker to proxy the manifest/chunks requests
  3. client script, that's the bit utilizing webtorrent (no webrtc in SW !)


  • Implement CLI tool that could live on top of existing feeds
  • Optimise p2p - shave off more time for webtorrent to download the chunks


Simple proof-of-concept for a live streaming solution based on webtorrent







No releases published


No packages published