MediaInfo observer for hls.js
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Hlsjs MediaInfo Module

Add-on module for hls.js to expose stream media info.
Tested with hls.js v0.10.1, might not work with earlier versions.


npm install          # install dev-dependences
npm install -g gulp  # install build tool
gulp release         # packaged & minimized js will be emitted in dist folder


<script src="hls.min.js"></script>
<script src="hlsjsMediaInfo.min.js"></script>
<video id="videoElement"></video>
    var hlsplayer = new Hls();
    hlsplayer.loadSource(...); // load your manifest here
    HlsjsMediaInfoModule.observeMediaInfo(hlsplayer); // setup observer

    hlsplayer.mediaInfo // this will hold info of stream when available

infos available

  • Event hlsMIStatPercentage:
    Triggered with download progress percentage, value is between 0 to 1

  • Property downloadSpeed:
    Fragments download speed, updated every second, in KB/s.

  • Property mediaInfo:
    Current playing quality stream info, see Level info for detail.

  • Property mediaInfoLevels:
    All parsed quality levels info, addition with a current property points to current downloading quality stream (This may not be the same as mediaInfo).

  • Level info

  |---- level: id of this quality level
  |---- bitrateMap: array holds correspoding bitrate for every second of muxed stream
  |---- video/audio: shared properties
  |          |----- timeScale: stream timing scale
  |          |----- samples: AVLTree object of sample size
  |          |----- bitrateMap: bitrate map of this seperate stream
  |          |----- totalDuration: sum of parsed samples' duration
  |          |----- totalSize: sum of parsed samples' size
  |          |----- averageBitrate: average bitrate calculated from parsed samples
  |---- video
  |       |----- videoCodec
  |       |----- width
  |       |----- height
  |       |----- fps
  |       |----- profile
  |       |----- level
  |       |----- chromaFormat
  |       |----- sarNum
  |       |----- sarDen
  |---- audio
          |----- audioCodec
          |----- audioSampleRate
          |----- audioChannelCount

Used compoments

flv.js (Modified fork)