Skip to content

Latest commit

 

History

History
28 lines (23 loc) · 1.73 KB

m3u8.md

File metadata and controls

28 lines (23 loc) · 1.73 KB

Introduction

The configuration of m3u8 and hls.js will have a great impact on the P2P streaming. The proper configuration can significantly increase the P2P ratio. It is not recommended to use multi-bitrate m3u8.

Recommended m3u8 Config for live

  • ts duration: <= 5 seconds
  • number of ts in playlist: >= 10

Allow Http Range Request

Range requests are used to get only a part of a file from the server (for instance, if part of the segment has been downloaded from peer, we retrieve the other part from the CDN). By using range requests you maximize the potential of our P2P technology. Without range requests, it is not possible to take advantage of chunks of media coming from P2P and if the segment is not downloaded as a whole, this data would be considered useless. If range request is activated, we are able to get chunks of data from peer and then complete the segments by getting other chunks from the CDN, thus, reducing your CDN bandwidth. Below is an example that shows how much CDN bandwidth is saved when range requests were activated:
http-range
To activate range requests, you should enable OPTIONS requests, and range requests on both origin of your stream and CDN:

OPTIONS REQUESTS

OPTIONS requests are mandatory to be able to perform RANGE requests in a cross-domain environment.

Your server/CDN must be able to handle OPTIONS requests. Most web-servers handle it natively.

The general idea is to add the following header to the HTTP response:

Access-Control-Allow-Methods: GET, OPTIONS

RANGE REQUESTS

The general idea is to add the following header to the HTTP response:

Access-Control-Allow-Headers: Range