XUtils

hls.js

A JavaScript library that implements an HTTP Live Streaming client. It relies on HTML5 video and MediaSource Extensions for playback.


Multivariant Playlist tags

  • #EXT-X-STREAM-INF:<attribute-list> <URI>
  • #EXT-X-MEDIA:<attribute-list>
  • #EXT-X-SESSION-DATA:<attribute-list>
  • #EXT-X-SESSION-KEY:<attribute-list> EME Key-System selection and preloading
  • #EXT-X-START:TIME-OFFSET=<n>
  • #EXT-X-CONTENT-STEERING:<attribute-list> Content Steering
  • #EXT-X-DEFINE:<attribute-list> Variable Substitution (NAME,VALUE,QUERYPARAM attributes)

The following properties are added to their respective variants’ attribute list but are not implemented in their selection and playback.

  • VIDEO-RANGE (See #2489)

Server-side-rendering (SSR) and require from a Node.js runtime

You can safely require this library in Node and absolutely nothing will happen. A dummy object is exported so that requiring the library does not throw an error. HLS.js is not instantiable in Node.js. See #1841 for more details.

Getting started with development

Open in StackBlitz

First, checkout the repository and install the required dependencies

git clone https://github.com/video-dev/hls.js.git
cd hls.js
# After cloning or pulling from the repository, make sure all dependencies are up-to-date
npm install ci
# Run dev-server for demo page (recompiles on file-watch, but doesn't write to actual dist fs artifacts)
npm run dev
### Linter (ESlint)

Run linter:

npm run lint


Run linter with auto-fix mode:

npm run lint:fix


Run linter with errors only (no warnings)

npm run lint:quiet


### Formatting Code

Run prettier to format code

npm run prettier


### Type Check

Run type-check to verify TypeScript types

npm run type-check


### Automated tests (Mocha/Karma)

Run all tests at once:

npm test


Run unit tests:

npm run test:unit


Run unit tests in watch mode:

npm run test:unit:watch


Run functional (integration) tests:

npm run test:func “`

Design

An overview of this project’s design, it’s modules, events, and error handling can be found here.

Demo

Latest Release

https://hlsjs.video-dev.org/demo

Master

https://hlsjs-dev.video-dev.org/demo

Specific Version

Find the commit on https://github.com/video-dev/hls.js/tree/deployments.

Using HLS.js

CORS

All HLS resources must be delivered with CORS headers permitting GET requests.

Video Control

Video is controlled through HTML <video> element HTMLVideoElement methods, events and optional UI controls (<video controls>).

Build a Custom UI

Player Integration

The following players integrate HLS.js for HLS playback:

They use HLS.js in production!

cdn77

Chrome/Firefox integration

made by gramk, plays hls from address bar and m3u8 links


Articles

  • coming soon...