Key components of the P2P network
All the components of the P2P network are free and open-source.
P2P Media Loader web browser requirements are:
- WebRTC Data Channels support to exchange data between peers
- Media Source Extensions are required by Hls.js and Shaka Player engines for media playback
WebTorrent tracker is used for WebRTC signaling and to create swarms of peers that download the same media stream. Few running public trackers are available: https://openwebtorrent.com/. It is possible to run personal WebTorrent tracker using open-source implementations: bittorrent-tracker, uWebTorrentTracker.
P2P Media Loader is configured to use public STUN and WebTorrent servers by default. It means that it is not required to run any server-side software for the P2P network to function.
How it works
A web browser runs a video player integrated with P2P Media Loader library. An instance of P2P Media Loader is called peer. Many peers form the P2P network.
P2P Media Loader starts to download initial media segments over HTTP(S) from source server or CDN. This allows beginning media playback faster. Also, in case of no peers, it will continue to download segments over HTTP(S) that will not differ from traditional media stream download over HTTP.
After that P2P Media Loader sends media stream details and its connection details (ICE candidates) to WebTorrent trackers and obtains from them list of other peers that are downloading the same media stream.
P2P Media Loader connects and starts to download media segments from the obtained peers as well as sharing already downloaded segments to them.
From time to time random peers from the P2P swarm download new segments over HTTP(S) and share them to others over P2P.
Only one media track is delivered over P2P. If video and audio tracks in HLS or MPEG-DASH go separately, just video is going to be shared over the P2P network.
Web browsers support
|Chrome||Firefox||macOS Safari||iOS Safari||IE||Edge|
|WebRTC Data Channels||+||+||+||+||-||-|
|Media Source Extensions||+||+||+||-||+||+|
|P2P Media Loader||+||+||+||-||-||-|