Git Product home page Git Product logo

hls.js's Introduction

Build Status Coverage Status npm

hls.js

hls.js is a JavaScript library which implements an HTTP Live Streaming client. It relies on HTML5 video and MediaSource Extensions for playback.

it works by transmuxing MPEG-2 Transport Stream into ISO BMFF (MP4) fragments. this transmuxing could be performed asynchronously using Web Worker if available in the browser.

hls.js does not need any player, it works directly on top of a standard HTML<video>element.

hls.js is written in ECMAScript6, and transpiled in ECMAScript5 using Babel.

Demo

public demo : http://dailymotion.github.io/hls.js/demo

private demo accessible from Dailymotion network: http://gdupontavice.dev.dailymotion.com/hls.js/demo/index.html

player integration

hls.js is (being) integrated in the following players:

it might also be integrated in the following players if you push for it !

Chrome integration

Firefox integration

Dependencies

No external JS libs are needed. prepackaged build is included in the [dist] (dist) folder:

  • [hls.js] (dist/hls.js)
  • [hls.min.js] (dist/hls.min.js)

if you want to bundle the application yourself, use node

npm install hls.js

Installation

either directly include dist/hls.js or dist/hls.min.js

or type

npm install --save hls.js

Compatibility

hls.js is compatible with browsers supporting MSE with 'video/MP4' inputs. as of today, it is supported on:

  • Chrome for Android 34+
  • Chrome for Desktop 34+
  • Firefox for Android 41+
  • Firefox for Desktop 42+
  • IE11+ for Windows 8.1
  • Safari for Mac 8+ (beta)

CORS

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

Features

  • VoD & Live playlists
    • DVR support on Live playlists
  • MPEG-2 TS container
  • AAC container (audio only streams)
  • 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
    • every internal events could be monitored (Network Events,Video Events)
    • playback session metrics are also exposed
  • resilience to errors
    • retry mechanism embedded in the library
    • recovery actions could be triggered fix fatal media or network errors
  • Redundant/Failover Playlists
  • Timed Metadata for HTTP Live Streaming (in ID3 format, carried in MPEG-2 TS)
  • AES-128 decryption (AES-128 mode)
  • CEA-708 captions (pop-on, channel 1)

Not Supported (Yet)

  • CEA-708 captions (roll-up, paint-on, channel 2)
  • MP3 / WebVTT container
  • Alternate Audio Track Rendition (Master Playlist with alternative Audio)

Supported M3U8 tags

Getting Started

<script src="https://cdn.jsdelivr.net/hls.js/latest/hls.min.js"></script>
<video id="video"></video>
<script>
  if(Hls.isSupported()) {
    var video = document.getElementById('video');
    var hls = new Hls();
    hls.loadSource('http://www.streambox.fr/playlists/test_001/stream.m3u8');
    hls.attachMedia(video);
    hls.on(Hls.Events.MANIFEST_PARSED,function() {
      video.play();
  });
 }
</script>

Video Control

video is controlled through HTML <video> element.

HTMLVideoElement control and events could be used seamlessly.

API and Configuration Parameters

hls.js can be configured and controlled easily, click here for details.

License

hls.js is released under Apache 2.0 License

Contributing

Pull requests are welcome. Here is a quick guide on how to start.

  • First, checkout the repository and install required dependencies
git clone https://github.com/dailymotion/hls.js.git
# setup dev environnement
cd hls.js
npm install
# build dist/hls.js, watch file change for rebuild and launch demo page
npm run dev
# lint
npm run lint
  • Use EditorConfig or at least stay consistent to the file formats defined in the .editorconfig file.
  • Develop in a topic branch, not master
  • Don't commit the updated dist/hls.js file in your PR. We'll take care of generating an updated build right before releasing a new tagged version.

Design

click here for details.

hls.js's People

Contributors

andrantos avatar avreg avatar bgaudaen avatar cbeckr avatar ciand7 avatar cmelendez avatar flavioribeiro avatar ghouet avatar gjanblaszczyk avatar greenkeeperio-bot avatar ipanasenko avatar jessetan avatar jhartman5 avatar jlacivita avatar joshua-andrassy avatar jsalaj avatar kanongil avatar leandromoreira avatar mangui avatar marco-c avatar moicci avatar nhjm449 avatar nireshkumar avatar phloxic avatar r3gis3r avatar ruslandinov avatar shaharmor avatar tchakabam avatar tjenkinson avatar wesleytodd avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.