back to home

video-dev / hls.js

HLS.js is a JavaScript library that plays HLS in browsers with support for MSE.

16,555 stars
2,740 forks
117 issues
TypeScriptJavaScriptHTML

AI Architecture Analysis

This repository is indexed by RepoMind. By analyzing video-dev/hls.js in our AI interface, you can instantly generate complete architecture diagrams, visualize control flows, and perform automated security audits across the entire codebase.

Our Agentic Context Augmented Generation (Agentic CAG) engine loads full source files into context on-demand, avoiding the fragmentation of traditional RAG systems. Ask questions about the architecture, dependencies, or specific features to see it in action.

Source files are only loaded when you start an analysis to optimize performance.

Embed this Badge

Showcase RepoMind's analysis directly in your repository's README.

[![Analyzed by RepoMind](https://img.shields.io/badge/Analyzed%20by-RepoMind-4F46E5?style=for-the-badge)](https://repomind.in/repo/video-dev/hls.js)
Preview:Analyzed by RepoMind

Repository Overview (README excerpt)

Crawler view

[comment]: <> ([![Sauce Test Status]&#40;https://saucelabs.com/browser-matrix/robwalch.svg&#41;]&#40;https://saucelabs.com/u/robwalch&#41;) HLS.js is a JavaScript library that implements an [HTTP Live Streaming] client. It relies on [HTML5 video][] and [MediaSource Extensions][] for playback. It works by transmuxing MPEG-2 Transport Stream and AAC/MP3 streams into ISO BMFF (MP4) fragments. Transmuxing is performed asynchronously using a [Web Worker] when available in the browser. HLS.js also supports HLS + fmp4, as announced during WWDC2016. HLS.js works directly on top of a standard HTML element. HLS.js is written in [ECMAScript6] ( ) and [TypeScript] ( ) (strongly typed superset of ES6), and transpiled in ECMAScript5 using Babel and the [TypeScript compiler]. [Rollup] is used to build the distro bundle and serve the local development environment. [html5 video]: https://www.html5rocks.com/en/tutorials/video/basics/ [mediasource extensions]: https://w3c.github.io/media-source/ [http live streaming]: https://en.wikipedia.org/wiki/HTTP_Live_Streaming [web worker]: https://caniuse.com/#search=worker [ecmascript6]: https://github.com/ericdouglas/ES6-Learning#articles--tutorials [typescript]: https://www.typescriptlang.org/ [typescript compiler]: https://www.typescriptlang.org/docs/handbook/compiler-options.html [rollup]: https://rollupjs.org/ Features • VOD & Live playlists • DVR support on Live playlists • Fragmented MP4 container • MPEG-2 TS container • ITU-T Rec. H.264 and ISO/IEC 14496-10 Elementary Stream • ITU-T Rec. H.265 and ISO/IEC 23008-2 Elementary Stream • ISO/IEC 13818-7 ADTS AAC Elementary Stream • ISO/IEC 11172-3 / ISO/IEC 13818-3 (MPEG-1/2 Audio Layer III) Elementary Stream • ATSC A/52 / AC-3 / Dolby Digital Elementary Stream • Packetized metadata (ID3v2.3.0) Elementary Stream • AAC container (audio only streams) • MPEG Audio container (MPEG-1/2 Audio Layer III audio only streams) • Timed Metadata for HTTP Live Streaming (ID3 format carried in MPEG-2 TS, Emsg in CMAF/Fragmented MP4, and DATERANGE playlist tags) • AES-128 decryption • "identity" format SAMPLE-AES decryption of MPEG-2 TS segments only • Encrypted media extensions (EME) support for DRM (digital rights management) • FairPlay, PlayReady, Widevine CDMs with fmp4 segments • Level capping based on HTMLMediaElement resolution, dropped-frames, and HDCP-Level • CEA-608/708 captions • WebVTT subtitles • Alternate Audio Track Rendition (Master Playlist with Alternative Audio) for VoD and Live playlists • Adaptive streaming • Manual & Auto Quality Switching • 3 Quality Switching modes are available (controllable through API means) • Instant switching (immediate quality switch at current video position) • Smooth switching (quality switch for next loaded fragment) • Bandwidth conservative switching (quality switch change for next loaded fragment, without flushing the buffer) • In Auto-Quality mode, emergency switch down in case bandwidth is suddenly dropping to minimize buffering. • Accurate Seeking on VoD & Live (not limited to fragment or keyframe boundary) • Ability to seek in buffer and back buffer without redownloading segments • Built-in Analytics • All internal events can be monitored (Network Events, Video Events) • Playback session metrics are also exposed • Resilience to errors • Retry mechanism embedded in the library • Recovery actions can be triggered fix fatal media or network errors • Redundant/Failover Playlists • HLS Variable Substitution Supported HLS tags For details on the HLS format and these tags' meanings, see https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis Multivariant Playlist tags • • • • EME Key-System selection and preloading • • Content Steering • Variable Substitution ( attributes) Media Playlist tags • (ignored) • (ignored) • (value is ignored) • • • • • • • • • • ( is only supports with MPEG-2 TS segments) • • • • • • Delta Playlists • • Metadata • HLS EXT-X-DATERANGE Schema for Interstitials • Variable Import and Substitution ( attributes) • (Skips loading GAP segments and parts. Skips playback of unbuffered program containing only GAP content and no suitable alternates. See #2940) Parsed but missing feature support: • (See #5074) • #5074 Not Supported For a complete list of issues, see "Top priorities" in the Release Planning and Backlog project tab. Codec support is dependent on the runtime environment (for example, not all browsers on the same OS support HEVC). • I-frame Media Playlist files • is not used in variant filtering or selection • "identity" format method keys with fmp4, aac, mp3, vtt... segments (MPEG-2 TS only) • MPEG-2 TS segments with FairPlay Streaming, PlayReady, or Widevine encryption • FairPlay Streaming legacy keys (For com.apple.fps.1_0 use native Safari playback) • MP3 elementary stream audio in IE and Edge (<=18) on Windows 10 (See #1641 and Microsoft answers forum) Server-side-rendering (SSR) and 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 First, checkout the repository and install the required dependencies The dev server will host files on port 8000. Once started, the demo can be found running at http://localhost:8000/demo/. Before submitting a PR, please see our contribution guidelines. Join the discussion on Slack via video-dev.org in #hlsjs for updates and questions about development. Build tasks Build all flavors (suitable for prod-mode/CI): Only debug-mode artifacts: Build and watch (customized dev setups where you'll want to host through another server - for example in a sub-module/project) Only specific flavor (known configs are: debug, dist, light, light-dist, demo): Note: The "demo" config is always built. **NOTE:** dist files do not include alternate-audio, subtitles, CMC…