hls.js

hls.js supports CMCD v1 and both CMCD v2 modes in its full build. CMCD stays off until you configure it.

Updated

Support

CMCD hls.js 1.7.4
CMCD v1 since 1.1.0
CMCD v2 since 1.7.0
Default transmission Query parameter
On by default No

CMCD is part of the full build, not the light build, and is off until you add a cmcd object. CMCD v2 is available since 1.7.0; the release notes state that not all v2 events and fields are supported yet.

Configuration

JavaScript
// All CMCD keys hls.js knows, plus the custom keys for player name and version.
const CMCD_KEYS = [
  'bl', 'br', 'bs', 'cid', 'd', 'dl', 'mtp', 'nor', 'nrr', 'ot', 'pr', 'rtp', 'sf', 'sid', 'st', 'su', 'tb', 'v',
  'ab', 'bg', 'bsa', 'bsd', 'bsda', 'cdn', 'cs', 'dfa', 'ec', 'lab', 'lb', 'ltc', 'msd', 'nr', 'pb', 'pt', 'sn',
  'sta', 'tab', 'tbl', 'tpb', 'cmsdd', 'cmsds', 'rc', 'smrt', 'ttfb', 'ttfbb', 'ttlb', 'url', 'cen', 'e', 'h', 'ts',
  'org.svta-p-n', 'org.svta-p-v',
];

const hls = new Hls({
  cmcd: {
    version: 2,
    contentId: '<CONTENT_ID>',
    includeKeys: CMCD_KEYS,
    eventTargets: [
      {
        url: '<CMCD_V2_ENDPOINT>',
        events: ['ps', 'e', 't'],
        includeKeys: CMCD_KEYS,
      },
    ],
    reporterCallback: (reporter) => {
      reporter.updateCustomData({
        'org.svta-p-n': 'hls.js',
        'org.svta-p-v': Hls.version,
      });
    },
  },
});
  • hls.js sends query parameters by default; set useHeaders: true to send headers instead.
  • Without sessionId, hls.js generates a UUID as session ID. There is no default content ID; set contentId only if you know it.
  • org.svta-p-n and org.svta-p-v report the player name and version, as defined in the CMCD custom key repository. hls.js sends all standard keys by default, but custom keys only when they are listed in includeKeys, so the example lists both, for requests and for the event target.
  • An event target without events sends nothing. t sends a status report every 30 seconds by default.
  • For CMCD v1, omit version and eventTargets.
  • <CMCD_V2_ENDPOINT> is the address of the EINBLIQ.IO CMCD v2 endpoint, provided during onboarding.

hls.js API documentation