Skip to content

Function: readInt8() ​

ts
function readInt8(cursor): number;

Defined in: cursor/readInt8.ts:18

Reads a signed integer of 1 byte.

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.