Function: writePssh()
ts
function writePssh(cursor, box): void;Defined in: writers/writePssh.ts:24
Write the pssh box (ProtectionSystemSpecificHeaderBox).
ISO/IEC 23001-7:2016 - 8.1
Parameters
cursor
The write cursor
box
ProtectionSystemSpecificHeaderBox
The ProtectionSystemSpecificHeaderBox fields to write
Returns
void
Throws
RangeError if a value of the box does not fit its field.
Example
ts
const writer = writeIsoBox(
{
type: 'pssh',
version: 1,
flags: 0,
systemId: new Uint8Array(16).fill(0xaa),
kid: [new Uint8Array(16).fill(0x11)],
data: new Uint8Array([1, 2, 3, 4]),
},
{ writers: { pssh: writePssh } },
)
// size (56), type (pssh), version and flags, SystemID, KID_count (1),
// the 16 bytes of the KID, DataSize (4), then the Data
assert.deepStrictEqual(
new Uint8Array(writer.buffer),
new Uint8Array([
0, 0, 0, 56, 112, 115, 115, 104, 1, 0, 0, 0, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0, 0, 0, 1, 0x11, 0x11, 0x11, 0x11, 0x11,
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0, 0, 0, 4, 1, 2, 3, 4,
]),
)