Coder Social home page Coder Social logo

kabsila / p2p-media-loader Goto Github PK

View Code? Open in Web Editor NEW

This project forked from novage/p2p-media-loader

0.0 2.0 0.0 835 KB

P2P Media Loader - engine for Hls.js and Shaka Player that enables P2P sharing of live and VOD streams over HLS or DASH

License: Apache License 2.0

JavaScript 2.30% TypeScript 66.53% HTML 31.17%

p2p-media-loader's Introduction

P2P Media Loader

P2P Media Loader is an open-source JavaScript library that uses features of modern browsers (i.e. WebRTC) to deliver media over P2P. It doesn’t require any browser plugins or addons to function.

It allows to create Peer-to-Peer network (also called P2P CDN or P2PTV) for traffic sharing between users (peers) that are watching the same media stream live or VOD over HLS or DASH protocols.

It significantly reduces traditional CDN traffic and cost while delivering media streams to more users.

Useful links

Key features

  • Supports live and VOD streams over HLS or DASH protocols.
  • Supports multiple players and engines
    Engines: Hls.js, ShakaPlayer
    Players: JWPlayer, Clappr, Flowplayer, MediaElement, VideoJS
  • Supports adaptive bitrate streaming of HLS and DASH protocols.
  • No need in server side software. By default P2P Media Loader uses publicly available servers:

Key components of the P2P network

All the components of the P2P network are free and open-source.

P2P Media Loader network

P2P Media Loader browser requirements are:

  • WebRTC Data Channels support to exchange data between peers
  • Media Source Extensions are required by Hls.js and ShakaPlayer engines for media playback

STUN server is used by WebRTC to gather ICE candidates. There are many running public servers available on Public STUN server list

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 browser runs a player integrated with P2P Media Loader library. Instance of P2P Media Loader is called peer. Many peers create P2P network.

P2P Media Loader starts downloading initial media segments over HTTP(S) from source server or CDN. This allows to begin 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 P2P swarm download new segments over HTTP(S) and share them to others over P2P.

p2p-media-loader's People

Contributors

greenya avatar mberesnev avatar mrlika avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.