Skip to content

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

License

Notifications You must be signed in to change notification settings

pldubouilh/live-torrent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

live-torrent

ex

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

Demo

Yes please ! Live demo with sintel at live.computer

Run it yourself

# Install
npm i -g live-torrent

# Start with example live-feed
live-torrent -u http://wms.shared.streamshow.it/carinatv/carinatv/ -p playlist.m3u8

# Open browser at http://127.0.0.1:8008

FAQ

I have a regular feed already

live-torrent can convert your feed into a webtorrent enabled feed. Just install the CLI tool and start converting your feed.

I want to create a feed !

Have a look in the server/ directory !

How to implement on a website ?

Just host the script/sw yourself. Also, there are some limitations to the use of SW ; it needs to be served from HTTPS, and it should be located at the root of the domain (e.g. https://live.computer/sw.js). Also feel free to open an issue if something's acting weird :)

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 that takes in a HLS feed and adds the magnet links to it
  2. serviceworker to proxy the manifest/chunks requests
  3. client script, that's the bit utilizing webtorrent (no webrtc in SW !)

TODO:

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

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published