Skip to content

Function: writeIsoBox() ​

ts
function writeIsoBox(box, config?): Uint8Array<ArrayBuffer>;

Defined in: writeIsoBox.ts:22

Write an ISO box to a Uint8Array.

Parameters ​

box ​

IsoBoxStreamable

The box to write

config? ​

IsoBoxWriteConfig

The optional configuration with the writers. With no writers, the function writes only byte arrays, raw boxes, and containers.

Returns ​

Uint8Array<ArrayBuffer>

The bytes of the box, in a new array with the exact size.

Throws ​

Error if a box has no writer, no bytes field, and a type outside CONTAINERS. The message starts with "No writer found for box type".

Throws ​

RangeError if a value of a box does not fit its field. Examples are a number outside the range, a missing value of a field that the flags select, and a list that is longer than its count field can state.

Throws ​

RangeError if a box has more than 2^32 - 1 bytes.

Example ​

ts
const bytes = writeIsoBox(
	{ type: 'tfdt', version: 1, flags: 0, baseMediaDecodeTime: 90000 },
	{ writers: { tfdt: writeTfdt } },
)

A Streaming Video Technology Alliance project.