Skip to content

Function: parseInitDataFromContentProtection() ​

ts
function parseInitDataFromContentProtection(cpData, BASE64): 
  | ArrayBuffer
  | null;

Defined in: cenc/parseInitDataFromContentProtection.ts:16

Parse a standard common encryption PSSH which contains a simple base64-encoding of the init data

Parameters ​

cpData ​

ContentProtection

The ContentProtection element that may contain PSSH data.

BASE64 ​

The BASE64 reference.

decodeArray ​

(input) => Uint8Array

Returns ​

| ArrayBuffer | null

init data as an ArrayBuffer, or null if not found.

Example ​

ts
const expected = base64Decode(cpData.pssh)
const result = parseInitDataFromContentProtection(cpData, BASE64)

strictEqual(result?.byteLength, expected.byteLength)

A Streaming Video Technology Alliance project.