Skip to content

Function: readFourCc() ​

ts
function readFourCc(cursor): string;

Defined in: cursor/readFourCc.ts:19

Reads a four-character code of 4 bytes, such as a box type or a brand.

Parameters ​

cursor ​

IsoBoxReadCursor<IsoInt64>

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

Returns ​

string

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.