Skip to content

Function: writeStsc() ​

ts
function writeStsc(cursor, box): void;

Defined in: writers/writeStsc.ts:22

Write the stsc box (SampleToChunkBox).

ISO/IEC 14496-12:2015 - 8.7.4

Parameters ​

cursor ​

IsoBoxWriteCursor

The write cursor

box ​

SampleToChunkBox

The SampleToChunkBox fields to write

Returns ​

void

Throws ​

RangeError if a value of the box does not fit its field.

Example ​

ts
const box = {
	type: 'stsc' as const,
	version: 0,
	flags: 0,
	entries: [
		{
			firstChunk: 1,
			samplesPerChunk: 10,
			sampleDescriptionIndex: 1,
		},
		{
			firstChunk: 5,
			samplesPerChunk: 5,
			sampleDescriptionIndex: 1,
		},
	],
}

const writer = writeIsoBox(box, { writers: { stsc: writeStsc } })
const buffer = new Uint8Array(writer.buffer)

A Streaming Video Technology Alliance project.