whatisgithub

What is hls.js?

video-dev/hls.js — explained in plain English

Analysis updated 2026-06-24

16,694TypeScriptAudience · developerComplexity · 3/5Setup · easy

In one sentence

A JavaScript library that plays HLS video streams in browsers that do not support HLS natively, using the standard HTML video element.

Mindmap

mindmap
  root((hls.js))
    Inputs
      HLS playlist URL
      HTML video element
    Outputs
      Playing video
      Adaptive bitrate switching
      Player events
    Use Cases
      Live stream player
      VOD player
      DRM protected content
    Tech Stack
      TypeScript
      Web Worker
      MSE
    Features
      Adaptive bitrate
      Subtitles
      Multi audio
      DRM
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Add HLS playback to a website using a plain HTML video element

USE CASE 2

Build a live sports streaming page that adapts quality to viewer bandwidth

USE CASE 3

Embed a DRM-protected video player with Widevine or FairPlay

USE CASE 4

Collect playback analytics by listening to hls.js events

What is it built with?

TypeScriptJavaScriptWeb Worker

How does it compare?

video-dev/hls.jseveryinc/compound-engineering-plugincarloscuesta/gitmoji
Stars16,69416,68316,744
LanguageTypeScriptTypeScriptTypeScript
Setup difficultyeasyeasyeasy
Complexity3/52/51/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 30min

Safari plays HLS natively so you need a fallback path, DRM streams need a license server.

So what is it?

HLS.js is a JavaScript library that lets web browsers play HLS video streams, the format used by Apple for streaming video over the internet. Normally, many browsers do not natively support HLS, so this library fills that gap by working directly with the standard HTML video element you already use on any website. With nearly 17,000 stars on GitHub, it is widely used in production video players across the web. The library handles both live streams and on-demand video (VOD), meaning you can use it for anything from live sports broadcasts to a Netflix-style video library. It automatically adjusts video quality based on the viewer's internet speed, switching up or down to prevent buffering, and it does this smoothly without interrupting playback. It supports subtitles, multiple audio tracks, content protection through digital rights management systems like FairPlay, PlayReady, and Widevine, and closed captions. The heavy processing work runs in a Web Worker in the background so it does not slow down the rest of the page. It also handles error recovery automatically, retrying failed network requests and switching to backup playlists if the primary stream goes down. For developers, all internal events are exposed so you can build analytics on top of it. If you are building a video product and need HLS playback in a browser, this library is one of the most battle-tested options available.

Copy-paste prompts

Prompt 1
Show me a 20-line HTML page that plays an HLS .m3u8 stream with hls.js
Prompt 2
Help me wire hls.js into a React component that falls back to native playback on Safari
Prompt 3
Set up adaptive bitrate switching and log every quality change to my analytics
Prompt 4
Configure hls.js to play a Widevine-protected stream with a license server URL
Prompt 5
Debug why my live HLS stream stalls every 30 seconds in hls.js

Frequently asked questions

What is hls.js?

A JavaScript library that plays HLS video streams in browsers that do not support HLS natively, using the standard HTML video element.

What language is hls.js written in?

Mainly TypeScript. The stack also includes TypeScript, JavaScript, Web Worker.

How hard is hls.js to set up?

Setup difficulty is rated easy, with roughly 30min to a first successful run.

Who is hls.js for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.