
Security News
TypeScript is Porting Its Compiler to Go for 10x Faster Builds
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
p2p-media-loader-shaka
Advanced tools
P2P Media Loader is an open-source JavaScript library that uses modern browser technologies — like HTML5 video and WebRTC — to enable peer-to-peer (P2P) media delivery. It integrates seamlessly with popular HTML5 video players and requires no additional browser plugins or add-ons. Try the demo to see it in action.
This library makes it possible to build large-scale P2P mesh networks — often called peer-to-peer content delivery networks (P2P CDN), Hybrid CDN, Multi CDN, peer-to-peer television (P2PTV), or Enterprise Content Delivery Networks (eCDN) — enabling users who are watching the same live or on-demand (VOD) streams via HLS or MPEG-DASH to share traffic in real time.
Works Everywhere: P2P Media Loader supports all modern desktop and mobile browsers — Chrome, Safari, Edge, Firefox, and Opera — across Windows, macOS, Android, iOS, iPadOS, and Linux. Check out our guide to set up P2P video in five minutes. You can also embed it into native iOS and Android apps and use it with native players.
No Setup Cost and No Server Software Needed: For smaller setups (1,000–2,000 simultaneous viewers), public trackers alone can handle peer connections. This means you don’t need to install or maintain any additional server-side components in many cases. Free alternatives are available for larger setups that can handle 100k simultaneous peers and above. Check our article on running dedicated trackers.
Reduced Load on Origin: Offloading requests from the CDN or media server to peers eases the strain on centralized infrastructure, increasing system reliability.
Significant Cost Savings: With less bandwidth required from your primary video source, you can dramatically cut CDN or hosting expenses.
Enhanced Total Bandwidth: When viewers share video data among themselves, they collectively expand overall network capacity, leading to smoother streaming for everyone.
Flexible for Live & VOD: Whether you’re streaming live events or on-demand videos, P2P Media Loader supports both scenarios without added complexity.
eCDN (Enterprise Content Delivery Network) Approach: In enterprise environments, you have full control over the internal network. This means peers can easily interconnect with minimal constraints, ensuring reliable, high-quality internal media delivery (e.g., multiple screens, desktops, and mobile devices across an organization) without straining external bandwidth or internal infrastructure.
Guides for HTML pages and web apps and for native mobile apps
npm packages
ES modules CDN
All the components of the P2P network are free and open-source.
P2P Media Loader required browser features are:
STUN server is used by WebRTC to gather ICE candidates. There are many running public servers available on Public STUN server list.
A compatible WebTorrent tracker is required for WebRTC signaling and to create swarms of peers downloading the same media stream. A few running public trackers are available: https://tracker.novage.com.ua/, https://tracker.webtorrent.dev/, https://openwebtorrent.com/.
It is possible to run personal WebTorrent tracker using open-source implementations: wt-tracker, Aquatic, OpenWebtorrent Tracker, bittorrent-tracker.
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 for simple use cases.
A web browser runs a video player that integrates with the P2P Media Loader library. Each instance of the library is referred to as a peer, and collectively, many peers form the P2P network.
P2P Media Loader initially downloads media segments over HTTP(S) from a source server or CDN to start media playback quickly. If no peers are available, it continues to download segments over HTTP(S), similar to a traditional media stream.
Subsequently, P2P Media Loader transmits media stream details and connection information, such as ICE candidates, to WebTorrent trackers. These trackers provide a list of other peers who are accessing the same media stream.
P2P Media Loader then connects with these peers to download additional media segments and simultaneously shares segments that it has already downloaded.
Periodically, random peers in the P2P swarm download new segments over HTTP(S) and distribute them to others via P2P.
FAQs
P2P Media Loader Shaka Player integration
The npm package p2p-media-loader-shaka receives a total of 83 weekly downloads. As such, p2p-media-loader-shaka popularity was classified as not popular.
We found that p2p-media-loader-shaka demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.