Skip to content

Function: beginIsoBox() ​

ts
function beginIsoBox(cursor, type): number;

Defined in: beginIsoBox.ts:21

Writes a box header with no size. endIsoBox writes the size.

A writer for a uuid box then writes the 16 bytes of usertype with writeBytes.

Parameters ​

cursor ​

IsoBoxWriteCursor

The cursor to write to.

type ​

string

The four-character code of the box.

Returns ​

number

The position of the first byte of the box. Pass it to endIsoBox.

Throws ​

RangeError if type does not have 4 characters of 1 byte each.

Example ​

ts
const cursor = createIsoBoxWriteCursor()

const start = beginIsoFullBox(cursor, 'mfhd', 0, 0)
writeUint32(cursor, 7) // sequence_number
endIsoBox(cursor, start)

const bytes = cursor.bytes.subarray(0, cursor.pos)

A Streaming Video Technology Alliance project.