Skip to content

Function: createDefaultReaderConfig() ​

ts
function createDefaultReaderConfig<V>(options?): IsoBoxReadConfig<V>;

Defined in: readers/createDefaultReaderConfig.ts:88

Create a default reader configuration with every reader except the container readers, such as readMoov. readIsoBoxes reads a container box that has no reader.

The int64 option selects the type of every 64-bit integer field. The readers of the configuration have the types of that option. Pass the option here and do not add it to the configuration afterward.

Type Parameters ​

V ​

V extends IsoInt64 = number

Parameters ​

options? ​

The options for the configuration.

int64? ​

IsoInt64Reader<V>

The function that reads every 64-bit integer field of the built-in readers.

Returns ​

IsoBoxReadConfig<V>

An IsoBoxReadConfig with all available readers pre-configured, except the container readers

Example ​

ts
// A moof box that holds a traf box with a version 1 tfdt box.
// baseMediaDecodeTime is 2^53 + 1, which a number cannot hold.
const bytes = new Uint8Array([
	0,
	0,
	0,
	36,
	0x6d,
	0x6f,
	0x6f,
	0x66, // moof
	0,
	0,
	0,
	28,
	0x74,
	0x72,
	0x61,
	0x66, // traf
	0,
	0,
	0,
	20,
	0x74,
	0x66,
	0x64,
	0x74,
	1,
	0,
	0,
	0, // tfdt, version 1
	0,
	0x20,
	0,
	0,
	0,
	0,
	0,
	1, // baseMediaDecodeTime
])
const boxes = readIsoBoxes(bytes, createDefaultReaderConfig({ int64: readInt64AsBigInt }))

// The field is a bigint with the exact value.
const tfdt = findIsoBox(boxes, box => isIsoBoxType('tfdt', box))

A Streaming Video Technology Alliance project.