Profile
Back to NewsBack
GitHub Trending 16 min
Reader Mode
video-dev/hls.js: HLS.js is a JavaScript library that plays HLS in browsers with support for MSE.

video-dev/hls.js: HLS.js is a JavaScript library that plays HLS in browsers with support for MSE.

13 hours ago

npm</a> npm</a> </a> Sauce Test Status</a> jsDeliver</a> inspect.software</a>

[comment]: <> ([![Sauce Test Status](https://saucelabs.com/browser-matrix/robwalch.svg)](https://saucelabs.com/u/robwalch))

!HLS.js

HLS.js is a JavaScript library that implements an [HTTP Live Streaming] client. It relies on [HTML5 video][] and [MediaSource Extensions][] for playback, and on [Managed Media Source][] where MSE is not available (Safari on iOS 17.1+).

It streams VOD, Live, and Low-Latency HLS assets made up of fragmented MP4 (fMP4), MPEG-2 Transport Stream, or Packed Audio segments. fMP4 segments (ISO BMFF, including CMAF) are passed through to MSE without remuxing, while MPEG-2 TS and Packed Audio (AAC, MP3, and AC-3) segments are transmuxed into fMP4. Transmuxing is performed asynchronously using a [Web Worker] when available in the browser.

HLS.js streams media into a standard HTML element, which handles decoding, rendering, playback, and seeking. Control playback through the [HTMLMediaElement] API, and use HLS.js to load assets, choose quality levels and tracks, and listen for streaming events. For assets with Interstitials, use hls.interstitialsManager to seek and track position on the integrated timeline of primary content and interstitial breaks.

HLS.js is written in [TypeScript] and transpiled using [Babel] to ECMAScript 5 syntax for the UMD bundles, and to native ES module syntax for the ESM bundles. The [TypeScript compiler] and [API Extractor] are used for type checking and to generate the hls.d.ts type declarations.

[Rollup] is used to build the distro bundles and, in watch mode, the local development environment. Each release includes:

  • full and light builds. The light build leaves out optional features such as alternate audio, subtitles, EME (DRM), CMCD, and Interstitials to reduce size (see Build tasks).
  • UMD bundles (hls.js, hls.light.js) for Chat with me