Skip to content

Function: readStco() ​

ts
function readStco(cursor): ChunkOffsetBox;

Defined in: readers/readStco.ts:22

Read the stco box (ChunkOffsetBox).

ISO/IEC 14496-12:2015 - 8.7.5

Parameters ​

cursor ​

IsoBoxReadCursor<IsoInt64>

The read cursor at the first byte after the box header

Returns ​

ChunkOffsetBox

A parsed ChunkOffsetBox

Example ​

ts
const isoFile = await readFile(new URL('../fixtures/captions.mp4', import.meta.url))
const boxes = readIsoBoxes(isoFile, {
	readers: {
		stco: readStco,
	},
})

const stco = findIsoBox(boxes, box => isIsoBoxType('stco', box))

assert.ok(stco)
assert.ok(isIsoBoxType('stco', stco))
assert.strictEqual(stco.chunkOffset.length, 30)
assert.strictEqual(stco.chunkOffset[0], 1056)

A Streaming Video Technology Alliance project.