@svta/common-media-library
    Preparing search index...

    Function parseInitDataFromContentProtection

    • Beta

      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: { decodeArray: (input: string) => Uint8Array }

        The BASE64 reference.

      Returns null | ArrayBuffer

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

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

      strictEqual(result?.byteLength, expected.byteLength);