About this project
P2P Media Loader is an open-source JavaScript library for peer-to-peer delivery of live and on-demand video directly in a web browser page. It uses browser technologies such as HTML5 video, WebRTC data channels, and Media Source Extensions, and integrates with popular HTML5 players without requiring plugins or add-ons.
The library is designed for building large-scale P2P mesh networks, often described as P2P CDN, hybrid CDN, multi-CDN, P2PTV, or enterprise CDN (eCDN). Viewers watching the same HLS or MPEG-DASH stream can share media segments in real time, which can reduce load on origin servers and CDNs, lower bandwidth costs, and increase total available bandwidth.
Key capabilities:
- Supports live and VOD streams over HLS or MPEG-DASH, including adaptive bitrate streaming.
- Works with Hls.js and Shaka Player engines, and can integrate with players such as Vidstack, Clappr, MediaElement, Plyr, DPlayer, OpenPlayerJS, and PlayerJS through custom integration with the library API.
- Runs in modern desktop and mobile browsers: Chrome, Firefox, Safari (macOS, iPadOS, iOS 17.1+), and Edge on Windows. It can also be embedded into native iOS and Android apps and used with native players.
- For simple setups, no server-side software is required: it defaults to public WebTorrent trackers and public STUN servers. For larger deployments, dedicated trackers can be run using open-source implementations such as wt-tracker, Aquatic, OpenWebtorrent Tracker, or bittorrent-tracker.
How it works: each browser instance running the library acts as a peer. Initially, media segments are fetched over HTTP(S) from the source server or CDN for fast playback start. The library then announces stream details and ICE candidates to WebTorrent trackers, receives a list of peers watching the same stream, connects to them, downloads additional segments from peers, and shares segments it already has. If no peers are available, it continues downloading over HTTP(S) like a traditional stream.
The project provides npm packages for the core, Hls.js integration, and Shaka Player integration, plus ES module and IIFE CDN builds for older browsers and smart TVs. Documentation includes API docs, guides for web and native mobile integration, a v3 to v4 migration guide, a demo, FAQ, and technical overview. Related software includes high-performance WebTorrent trackers.
Comments
0 people shared their preference · Deer Point appears after 10 participants
Sign in to join the discussion.