Skip to content

Function: readTemplate32() ​

ts
function readTemplate32(cursor): number;

Defined in: cursor/readTemplate32.ts:18

Reads an unsigned fixed-point value of 4 bytes (16.16): 2 bytes for the integer part and 2 bytes for the fraction.

Parameters ​

cursor ​

IsoBoxReadCursor<IsoInt64>

The cursor to read from. The function moves the cursor past the field.

Returns ​

number

The value of the field.

Throws ​

RangeError if the field passes cursor.end.

Example ​

ts
// The body of an `mfhd` box: version, flags, and sequence_number.
const cursor = createIsoBoxReadCursor(new Uint8Array([0, 0, 0, 0, 0, 0, 0, 7]))

const version = readUint8(cursor) // 0
const flags = readUint24(cursor) // 0
const sequenceNumber = readUint32(cursor) // 7

A Streaming Video Technology Alliance project.