What is P2P video delivery?

In P2P (Peer-to-Peer) video delivery, each end-user (“peer”) downloads a video stream and simultaneously uploads that stream to other end-users. In other words, a peer simultaneously acts as a client and a server thus contributing to the overall available bandwidth. 

For P2P video delivery to work, first, it needs to establish connections between devices (“peers”) streaming your video content. Once the connection is established, these peers can cache and share video content, as they are streaming the video content at the same time. However, peers have to store some amount of data and exchange state information with each other to preserve connectivity and allow sharing of video streams. As long as those peers are offering enough outgoing bandwidth, each peer should be able to deliver and receive video content from its connected peers. 

The main goal of P2P video delivery is to deliver high-quality and scalable video streams at minimum bandwidth requirements, regardless of the irregularity of each peer’s capabilities and/or network speeds. This is made possible since the number of resources available to the network dynamically grows with the number of peers. As the number of peers increases, so as the available streaming resources, providing a much higher quality and stable video stream without a single point of failure.

In P2P video delivery, requests are handled by peers, hence this can significantly reduce requests from the stream source (origin server and CDNs) resulting in more cost-effective video delivery. In addition, P2P video delivery also uses WebRTC protocol which is compatible with every modern browser, hence it can be implemented easily and can also provide additional stream source privacy protection.

Since Mlytics Stream operates under HLS (HTTP Live Streaming) protocol, wherein the video source is composed of a playlist (.m3u8 file) and several video segments (.ts file), it is typical for peers to have different playback progress. The reason for this is because, video streams are only played and passed to other peers as soon as they are requested. 

One downside of P2P video delivery is that, the behavior of peers can be somewhat unpredictable, as they may join and leave the service at any time. This behavior may disrupt the video stream delivery. However, this kind of disruption can be minimized since another peer or a CDN that received the same resource can immediately handle the same request. On extreme cases, video segments that are received with unadaptable delay will be considered lost and may be a potential cause of visible video degradation. 

Finally, P2P video delivery can be used for both live-streaming and video-on-demand.