A TypeScript parser to convert a Base64-encoded string representing an MP4 PSSH box into a POJO. More information about MP4 PSSH boxes can be found here.
This repository is hosted on NPM. Install this package using:
npm i @re/mp4pssh
The parser can then be imported using:
import { PSSHParser } from '@re/mp4pssh'
Begin by getting a Base64-encoded string representing an MP4 PSSH box.
Create a new instance of the PSSHParser
class:
const psshParser = new PSSHParser();
Use the parsePSSH()
method to parse the Base64-encoded PSSH box into a POJO:
const pssh = psshParser.parsePSSH(<BASE64_PSSH>);
Users can then access the information encoded in the PSSH:
-
version <number>
: The version of the parsed PSSH -
systemId <string>
: The ID of the system that will consume the PSSH data -
kidCount <number>
: The number of KIDs included in the PSSH -
kids <string[]>
: The KIDs included in the PSSH -
dataSize <number>
: The length of ths PSSH data (in bytes) -
data <Uint8Array>
: The PSSH data
This repo was written and maintained by RealEyes Media, a Video Streaming consultancy based in Denver, CO, USA. Contributions are welcome via PRs.
This repo uses Jest as its testing framework. To test, use:
npm test
This repo uses Webpack and Babel as its build frameworks. To build, use:
npm run build
MIT