What is Media PeerPool?
Media PeerPool Demo
Click here to open in a new window. Try opening multiple tabs with the same stream, navigate through them, and observe how the P2P network gradually takes over the data transfer. After a few minutes, you will notice a significant reduction in the CDN usage as the Media PeerPool technology offloads network traffic to the P2P network. This leads to a better user experience by improving streaming quality and reducing latency.
Integration
Since PeerPool only requires Javascript, integrating it into your website is seamless for end-users and only requires a minor modification to your site's HTML page.
The client-side integration will depend on the player you are using and typically involves adding just a single line of code to your page. To achieve this, include the following scripts in the head section of your player's page:
<script src="https://media.network/demo/peerpool.js"></script>
Complete Example (Clappr)
<style>body{margin:0}#video{width:100vw;height:100vh;}</style>
<div id="video"></div>
<script src="https://media.network/demo/peerpool.js"></script>
<script src="https://cdn.jsdelivr.net/npm/clappr@latest"></script>
<script>
if (p2pml.hlsjs.Engine.isSupported()) {
var engine = new p2pml.hlsjs.Engine();
var loader = engine.createLoaderClass();
} else {
var loader = XHRLoader;
}
var engine = new p2pml.hlsjs.Engine();
var player = new Clappr.Player({
parentId: "#video",
source: "https://client123.cdnprovider.com/live/STREAM_NAME/index.m3u8",
width:"100%",
height:"100%",
playback: {
hlsjsConfig: {
liveSyncDurationCount: 7,
loader: loader
}
}
});
if (p2pml.hlsjs.Engine.isSupported()) p2pml.hlsjs.initClapprPlayer(player);
player.play(true);
</script>