Skip to content

🎥 Make videos programmatically with React

on simple blocks

Jonny Burger82984f1085fd
diff --git a/packages/media-parser/src/boxes/webm/parse-webm-header.ts b/packages/media-parser/src/boxes/webm/parse-webm-header.ts
index 53d1119f24..1b359ba430 100644
--- a/packages/media-parser/src/boxes/webm/parse-webm-header.ts
+++ b/packages/media-parser/src/boxes/webm/parse-webm-header.ts
@@ -1,9 +1,13 @@
import type {BufferIterator} from '../../buffer-iterator';
import type {ParseResult} from '../../parse-result';
import {expectSegment} from './segments';
+import type {OnSimpleBlock} from './segments/track-entry';
// Parsing according to https://darkcoding.net/software/reading-mediarecorders-webm-opus-output/
-export const parseWebm = (counter: BufferIterator): ParseResult => {
+export const parseWebm = (
+ counter: BufferIterator,
+ onSimpleBlock: OnSimpleBlock,
+): ParseResult => {
counter.discard(4);
const length = counter.getVint();
@@ -14,5 +18,5 @@ export const parseWebm = (counter: BufferIterator): ParseResult => {
// Discard header for now
counter.discard(length);
- return expectSegment(counter);
+ return expectSegment(counter, onSimpleBlock);
};
diff --git a/packages/media-parser/src/boxes/webm/segments.ts b/packages/media-parser/src/boxes/webm/segments.ts
index 7c278b9dd3..bba1337a99 100644
--- a/packages/media-parser/src/boxes/webm/segments.ts
+++ b/packages/media-parser/src/boxes/webm/segments.ts
@@ -37,6 +37,7 @@ import type {
InterlacedSegment,
LanguageSegment,
MaxBlockAdditionId,
+ OnSimpleBlock,
SegmentUUIDSegment,
SimpleBlockSegment,
TagSegment,
@@ -133,10 +134,12 @@ const parseSegment = ({
segmentId,
iterator,
length,
+ onSimpleBlock,
}: {
segmentId: string;
iterator: BufferIterator;
length: number;
+ onSimpleBlock: OnSimpleBlock;
}): MatroskaSegment => {
if (length === 0) {
throw new Error('Expected length to be greater than 0');
@@ -150,7 +153,7 @@ const parseSegment = ({
}
if (segmentId === '0x114d9b74') {
- return parseSeekHeadSegment(iterator, length);
+ return parseSeekHeadSegment(iterator, length, onSimpleBlock);
}
if (segmentId === '0x53ab') {
@@ -158,7 +161,7 @@ const parseSegment = ({
}
if (segmentId === '0x4dbb') {
- return parseSeekSegment(iterator, length);
+ return parseSeekSegment(iterator, length, onSimpleBlock);
}
if (segmentId === '0x53ac') {
@@ -170,7 +173,7 @@ const parseSegment = ({
}
if (segmentId === '0x1549a966') {
- return parseInfoSegment(iterator, length);
+ return parseInfoSegment(iterator, length, onSimpleBlock);
}
if (segmentId === '0x2ad7b1') {
@@ -190,11 +193,11 @@ const parseSegment = ({
}
if (segmentId === '0x1654ae6b') {
- return parseTracksSegment(iterator, length);
+ return parseTracksSegment(iterator, length, onSimpleBlock);
}
if (segmentId === '0xae') {
- return parseTrackEntry(iterator, length);
+ return parseTrackEntry(iterator, length, onSimpleBlock);
}
if (segmentId === '0xd7') {
@@ -234,7 +237,7 @@ const parseSegment = ({
}
if (segmentId === '0xe0') {
- return parseVideoSegment(iterator, length);
+ return parseVideoSegment(iterator, length, onSimpleBlock);
}
if (segmentId === '0xb0') {
@@ -274,7 +277,7 @@ const parseSegment = ({
}
if (segmentId === '0x1254c367') {
- return parseTagsSegment(iterator, length);
+ return parseTagsSegment(iterator, length, onSimpleBlock);
}
if (segmentId === '0x7373') {
@@ -286,11 +289,11 @@ const parseSegment = ({
}
if (segmentId === '0xa3') {
- return parseSimpleBlockSegment(iterator, length);
+ return parseSimpleBlockSegment(iterator, length, onSimpleBlock);
}
if (segmentId === '0xa0') {
- return parseBlockGroupSegment(iterator, length);
+ return parseBlockGroupSegment(iterator, length, onSimpleBlock);
}
if (segmentId === '0xa1') {
@@ -307,14 +310,17 @@ const parseSegment = ({
return child;
};
-export const expectSegment = (iterator: BufferIterator): ParseResult => {
+export const expectSegment = (
+ iterator: BufferIterator,
+ onSimpleBlock: OnSimpleBlock,
+): ParseResult => {
const bytesRemaining_ = iterator.bytesRemaining();
if (bytesRemaining_ === 0) {
return {
status: 'incomplete',
segments: [],
continueParsing: () => {
- return expectSegment(iterator);
+ return expectSegment(iterator, onSimpleBlock);
},
skipTo: null,
};
@@ -341,6 +347,7 @@ export const expectSegment = (iterator: BufferIterator): ParseResult => {
type: 'cluster-segment',
children: s,
}),
+ onSimpleBlock,
});
if (main.status === 'incomplete') {
return {
@@ -364,13 +371,13 @@ export const expectSegment = (iterator: BufferIterator): ParseResult => {
status: 'incomplete',
segments: [],
continueParsing: () => {
- return expectSegment(iterator);
+ return expectSegment(iterator, onSimpleBlock);
},
skipTo: null,
};
}
- const segment = parseSegment({segmentId, iterator, length});
+ const segment = parseSegment({segmentId, iterator, length, onSimpleBlock});
return {
status: 'done',
segments: [segment],
diff --git a/packages/media-parser/src/boxes/webm/segments/info.ts b/packages/media-parser/src/boxes/webm/segments/info.ts
index 8f07adf819..8e3e36315b 100644
--- a/packages/media-parser/src/boxes/webm/segments/info.ts
+++ b/packages/media-parser/src/boxes/webm/segments/info.ts
@@ -1,6 +1,7 @@
import type {BufferIterator} from '../../../buffer-iterator';
import type {MatroskaSegment} from '../segments';
import {expectChildren} from './parse-children';
+import type {OnSimpleBlock} from './track-entry';
export type InfoSegment = {
type: 'info-segment';
@@ -11,12 +12,15 @@ export type InfoSegment = {
export const parseInfoSegment = (
iterator: BufferIterator,
length: number,
+ onSimpleBlock: OnSimpleBlock,
): InfoSegment => {
const children = expectChildren({
iterator,
length,
initialChildren: [],
wrap: null,
+ onSimpleBlock,
+ allowIncomplete: false,
});
if (children.status === 'incomplete') {
diff --git a/packages/media-parser/src/boxes/webm/segments/parse-children.ts b/packages/media-parser/src/boxes/webm/segments/parse-children.ts
index 3889b81f88..69d7714880 100644
--- a/packages/media-parser/src/boxes/webm/segments/parse-children.ts
+++ b/packages/media-parser/src/boxes/webm/segments/parse-children.ts
@@ -2,6 +2,7 @@ import type {BufferIterator} from '../../../buffer-iterator';
import type {ParseResult} from '../../../parse-result';
import type {MatroskaSegment} from '../segments';
import {expectSegment} from '../segments';
+import type {OnSimpleBlock} from './track-entry';
type WrapChildren = (segments: MatroskaSegment[]) => MatroskaSegment;
@@ -10,11 +11,13 @@ export const expectChildren = ({
length,
initialChildren,
wrap,
+ onSimpleBlock,
}: {
iterator: BufferIterator;
length: number;
initialChildren: MatroskaSegment[];
wrap: WrapChildren | null;
+ onSimpleBlock: OnSimpleBlock;
}): ParseResult => {
const children: MatroskaSegment[] = [...initialChildren];
const startOffset = iterator.counter.getOffset();
@@ -25,7 +28,7 @@ export const expectChildren = ({
break;
}
- const child = expectSegment(iterator);
+ const child = expectSegment(iterator, onSimpleBlock);
if (child.status === 'incomplete') {
const endOffset = iterator.counter.getOffset();
@@ -40,6 +43,7 @@ export const expectChildren = ({
length: length - (blockOffset - startOffset),
initialChildren: children,
wrap,
+ onSimpleBlock,
});
},
skipTo: null,
diff --git a/packages/media-parser/src/boxes/webm/segments/seek-head.ts b/packages/media-parser/src/boxes/webm/segments/seek-head.ts
index 5298808764..61a2750cc2 100644
--- a/packages/media-parser/src/boxes/webm/segments/seek-head.ts
+++ b/packages/media-parser/src/boxes/webm/segments/seek-head.ts
@@ -1,6 +1,7 @@
import type {BufferIterator} from '../../../buffer-iterator';
import {type MatroskaSegment} from '../segments';
import {expectChildren} from './parse-children';
+import type {OnSimpleBlock} from './track-entry';
export type SeekHeadSegment = {
type: 'seek-head-segment';
@@ -11,12 +12,14 @@ export type SeekHeadSegment = {
export const parseSeekHeadSegment = (
iterator: BufferIterator,
length: number,
+ onSimpleBlock: OnSimpleBlock,
): SeekHeadSegment => {
const children = expectChildren({
iterator,
length,
initialChildren: [],
wrap: null,
+ onSimpleBlock,
});
if (children.status === 'incomplete') {
diff --git a/packages/media-parser/src/boxes/webm/segments/seek.ts b/packages/media-parser/src/boxes/webm/segments/seek.ts
index 5bddd906bd..edb8c1b491 100644
--- a/packages/media-parser/src/boxes/webm/segments/seek.ts
+++ b/packages/media-parser/src/boxes/webm/segments/seek.ts
@@ -1,6 +1,7 @@
import type {BufferIterator} from '../../../buffer-iterator';
import type {MatroskaSegment} from '../segments';
import {expectChildren} from './parse-children';
+import type {OnSimpleBlock} from './track-entry';
export type SeekSegment = {
type: 'seek-segment';
@@ -10,12 +11,15 @@ export type SeekSegment = {
export const parseSeekSegment = (
iterator: BufferIterator,
length: number,
+ onSimpleBlock: OnSimpleBlock,
): SeekSegment => {
const children = expectChildren({
iterator,
length,
initialChildren: [],
wrap: null,
+ onSimpleBlock,
+ allowIncomplete: false,
});
if (children.status === 'incomplete') {
throw new Error('Incomplete children');
diff --git a/packages/media-parser/src/boxes/webm/segments/track-entry.ts b/packages/media-parser/src/boxes/webm/segments/track-entry.ts
index 9f022d1a04..ce1fdfc58f 100644
--- a/packages/media-parser/src/boxes/webm/segments/track-entry.ts
+++ b/packages/media-parser/src/boxes/webm/segments/track-entry.ts
@@ -1,4 +1,3 @@
-import {expectBitstream} from '../../../bitstream/av1';
import type {BufferIterator} from '../../../buffer-iterator';
import type {MatroskaSegment} from '../segments';
import {expectChildren} from './parse-children';
@@ -11,12 +10,14 @@ export type TrackEntrySegment = {
export const parseTrackEntry = (
iterator: BufferIterator,
length: number,
+ onSimpleBlock: OnSimpleBlock,
): TrackEntrySegment => {
const children = expectChildren({
iterator,
length,
initialChildren: [],
wrap: null,
+ onSimpleBlock,
});
if (children.status === 'incomplete') {
throw new Error('Incomplete children ' + length);
@@ -207,12 +208,14 @@ export type VideoSegment = {
export const parseVideoSegment = (
iterator: BufferIterator,
length: number,
+ onSimpleBlock: OnSimpleBlock,
): VideoSegment => {
const children = expectChildren({
iterator,
length,
initialChildren: [],
wrap: null,
+ onSimpleBlock,
});
if (children.status === 'incomplete') {
@@ -438,12 +441,14 @@ export type TagsSegment = {
export const parseTagsSegment = (
iterator: BufferIterator,
length: number,
+ onSimpleBlock: OnSimpleBlock,
): TagsSegment => {
const children = expectChildren({
iterator,
length,
initialChildren: [],
wrap: null,
+ onSimpleBlock,
});
if (children.status === 'incomplete') {
@@ -508,12 +513,23 @@ export type SimpleBlockSegment = {
keyframe: boolean;
lacing: [number, number];
invisible: boolean;
- children: null;
};
+export type OnSimpleBlockData = {
+ data: Uint8Array;
+ trackNumber: number;
+ timecode: number;
+ keyframe: boolean;
+ lacing: [number, number];
+ invisible: boolean;
+};
+
+export type OnSimpleBlock = (params: OnSimpleBlockData) => void;
+
export const parseSimpleBlockSegment = (
iterator: BufferIterator,
length: number,
+ onSimpleBlock: OnSimpleBlock,
): SimpleBlockSegment => {
const trackNumber = iterator.getVint();
const timecode = iterator.getUint16();
@@ -524,7 +540,16 @@ export const parseSimpleBlockSegment = (
const pos7 = (headerFlags >> 6) & 1;
const keyframe = Boolean((headerFlags >> 7) & 1);
- const children = expectBitstream(iterator, length - 4);
+ const bitstream = iterator.getSlice(length - 4);
+
+ onSimpleBlock({
+ data: bitstream,
+ trackNumber,
+ timecode,
+ keyframe,
+ lacing: [pos6, pos7],
+ invisible,
+ });
return {
type: 'simple-block-segment',
@@ -535,7 +560,6 @@ export const parseSimpleBlockSegment = (
keyframe,
lacing: [pos6, pos7],
invisible,
- children: null,
};
};
@@ -563,12 +587,14 @@ export type BlockGroupSegment = {
export const parseBlockGroupSegment = (
iterator: BufferIterator,
length: number,
+ onSimpleBlock: OnSimpleBlock,
): BlockGroupSegment => {
const children = expectChildren({
iterator,
length,
initialChildren: [],
wrap: null,
+ onSimpleBlock,
});
if (children.status === 'incomplete') {
throw new Error('Incomplete boxes are not allowed');
diff --git a/packages/media-parser/src/boxes/webm/segments/tracks.ts b/packages/media-parser/src/boxes/webm/segments/tracks.ts
index 7232e33e60..3bda0934e8 100644
--- a/packages/media-parser/src/boxes/webm/segments/tracks.ts
+++ b/packages/media-parser/src/boxes/webm/segments/tracks.ts
@@ -1,6 +1,7 @@
import type {BufferIterator} from '../../../buffer-iterator';
import type {MatroskaSegment} from '../segments';
import {expectChildren} from './parse-children';
+import type {OnSimpleBlock} from './track-entry';
export type TracksSegment = {
type: 'tracks-segment';
@@ -10,12 +11,14 @@ export type TracksSegment = {
export const parseTracksSegment = (
iterator: BufferIterator,
length: number,
+ onSimpleBlock: OnSimpleBlock,
): TracksSegment => {
const children = expectChildren({
iterator,
length,
initialChildren: [],
wrap: null,
+ onSimpleBlock,
});
if (children.status === 'incomplete') {
diff --git a/packages/media-parser/src/get-tracks.ts b/packages/media-parser/src/get-tracks.ts
index 5cf95bca14..d8b989683b 100644
--- a/packages/media-parser/src/get-tracks.ts
+++ b/packages/media-parser/src/get-tracks.ts
@@ -102,6 +102,16 @@ const getMatroskaVideoCodecString = (track: TrackEntrySegment): string => {
return 'vp8';
}
+ if (codec.codec === 'V_VP9') {
+ return 'vp9';
+ }
+
+ if (codec.codec === 'V_MPEG4/ISO/AVC') {
+ // TODO: different avc1!
+ // Failing test: Should stream MKV video
+ return 'avc1';
+ }
+
if (codec.codec === 'V_AV1') {
return av1CodecStringToString(track);
}
@@ -120,6 +130,11 @@ const getMatroskaAudioCodecString = (track: TrackEntrySegment): string => {
return 'opus';
}
+ // TODO: Wrong, see here how to parse it correctly
+ if (codec.codec === 'A_PCM/INT/LIT') {
+ return 'pcm-s16';
+ }
+
throw new Error(`Unknown codec: ${codec.codec}`);
};
@@ -151,6 +166,10 @@ const getTracksFromMatroska = (
const audioTracks: AudioTrack[] = [];
for (const track of tracksSegment.children) {
+ if (track.type === 'crc32-segment') {
+ continue;
+ }
+
if (track.type !== 'track-entry-segment') {
throw new Error('Expected track entry segment');
}
diff --git a/packages/media-parser/src/parse-media.ts b/packages/media-parser/src/parse-media.ts
index 908e489ff0..3b9525bf0b 100644
--- a/packages/media-parser/src/parse-media.ts
+++ b/packages/media-parser/src/parse-media.ts
@@ -1,3 +1,7 @@
+import type {
+ OnSimpleBlock,
+ OnSimpleBlockData,
+} from './boxes/webm/segments/track-entry';
import type {BufferIterator} from './buffer-iterator';
import {getArrayBufferIterator} from './buffer-iterator';
import {fetchReader} from './from-fetch';
@@ -37,15 +41,24 @@ export const parseMedia: ParseMedia = async ({
let iterator: BufferIterator | null = null;
let parseResult: ParseResult | null = null;
+ const simpleBlockQueue: OnSimpleBlockData[] = [];
+
+ const onSimpleBlock: OnSimpleBlock = (params) => {
+ simpleBlockQueue.push(params);
+ };
+
while (parseResult === null || parseResult.status === 'incomplete') {
const result = await currentReader.read();
- if (result.done) {
- break;
- }
if (iterator) {
- iterator.addData(result.value);
+ if (!result.done) {
+ iterator.addData(result.value);
+ }
} else {
+ if (result.done) {
+ throw new Error('Unexpectedly reached EOF');
+ }
+
iterator = getArrayBufferIterator(
result.value,
contentLength ?? undefined,
@@ -61,10 +74,30 @@ export const parseMedia: ParseMedia = async ({
canSkipVideoData: !(onAudioSample || onVideoSample),
onAudioSample: onAudioSample ?? null,
onVideoSample: onVideoSample ?? null,
+ // TODO: Skip frames if onSimpleBlock is null
+ onSimpleBlock,
},
});
}
+ if (simpleBlockQueue.length > 0) {
+ const {audioTracks, videoTracks} = getTracks(parseResult.segments);
+
+ for (const block of simpleBlockQueue) {
+ const matchingAudioTrack = audioTracks.find(
+ (t) => t.type === 'audio' && t.trackId === block.trackNumber,
+ );
+ const matchingVideoTrack = videoTracks.find(
+ (t) => t.type === 'video' && t.trackId === block.trackNumber,
+ );
+ if (!matchingAudioTrack && !matchingVideoTrack) {
+ throw new Error('No track found for block');
+ }
+ }
+
+ simpleBlockQueue.length = 0;
+ }
+
if (hasAllInfo(fields, parseResult)) {
if (!currentReader.closed) {
currentReader.cancel(new Error('has all information'));
diff --git a/packages/media-parser/src/parse-video.ts b/packages/media-parser/src/parse-video.ts
index 3bf6f32383..36dd893fc6 100644
--- a/packages/media-parser/src/parse-video.ts
+++ b/packages/media-parser/src/parse-video.ts
@@ -47,7 +47,7 @@ export const parseVideo = ({
}
if (iterator.isWebm()) {
- return parseWebm(iterator);
+ return parseWebm(iterator, options.onSimpleBlock);
}
throw new Error('Unknown video format');
diff --git a/packages/media-parser/src/parser-context.ts b/packages/media-parser/src/parser-context.ts
index 0ccefdc7ca..b05af8391b 100644
--- a/packages/media-parser/src/parser-context.ts
+++ b/packages/media-parser/src/parser-context.ts
@@ -2,9 +2,11 @@ import type {
OnAudioSample,
OnVideoSample,
} from './boxes/iso-base-media/mdat/mdat';
+import type {OnSimpleBlock} from './boxes/webm/segments/track-entry';
export type ParserContext = {
onAudioSample: OnAudioSample | null;
onVideoSample: OnVideoSample | null;
+ onSimpleBlock: OnSimpleBlock;
canSkipVideoData: boolean;
};
diff --git a/packages/media-parser/src/test/matroska.test.ts b/packages/media-parser/src/test/matroska.test.ts
index 4d4a08e15a..6296266175 100644
--- a/packages/media-parser/src/test/matroska.test.ts
+++ b/packages/media-parser/src/test/matroska.test.ts
@@ -200,7 +200,6 @@ test('Should get duration of AV1 video', async () => {
keyframe: true,
lacing: [0, 0],
invisible: false,
- children: null,
},
{
type: 'simple-block-segment',
@@ -211,7 +210,6 @@ test('Should get duration of AV1 video', async () => {
keyframe: false,
lacing: [0, 0],
invisible: false,
- children: null,
},
{
type: 'simple-block-segment',
@@ -222,7 +220,6 @@ test('Should get duration of AV1 video', async () => {
keyframe: false,
lacing: [0, 0],
invisible: false,
- children: null,
},
{
type: 'simple-block-segment',
@@ -233,7 +230,6 @@ test('Should get duration of AV1 video', async () => {
keyframe: false,
lacing: [0, 0],
invisible: false,
- children: null,
},
{
type: 'simple-block-segment',
@@ -244,7 +240,6 @@ test('Should get duration of AV1 video', async () => {
keyframe: false,
lacing: [0, 0],
invisible: false,
- children: null,
},
{
type: 'simple-block-segment',
@@ -255,7 +250,6 @@ test('Should get duration of AV1 video', async () => {
keyframe: false,
lacing: [0, 0],
invisible: false,
- children: null,
},
{
type: 'simple-block-segment',
@@ -266,7 +260,6 @@ test('Should get duration of AV1 video', async () => {
keyframe: false,
lacing: [0, 0],
invisible: false,
- children: null,
},
{
type: 'simple-block-segment',
@@ -277,7 +270,6 @@ test('Should get duration of AV1 video', async () => {
keyframe: false,
lacing: [0, 0],
invisible: false,
- children: null,
},
{
type: 'simple-block-segment',
@@ -288,7 +280,6 @@ test('Should get duration of AV1 video', async () => {
keyframe: false,
lacing: [0, 0],
invisible: false,
- children: null,
},
{
type: 'simple-block-segment',
@@ -299,7 +290,6 @@ test('Should get duration of AV1 video', async () => {
keyframe: false,
lacing: [0, 0],
invisible: false,
- children: null,
},
{
type: 'simple-block-segment',
@@ -310,7 +300,6 @@ test('Should get duration of AV1 video', async () => {
keyframe: false,
lacing: [0, 0],
invisible: false,
- children: null,
},
{
type: 'simple-block-segment',
@@ -321,7 +310,6 @@ test('Should get duration of AV1 video', async () => {
keyframe: false,
lacing: [0, 0],
invisible: false,
- children: null,
},
{
type: 'simple-block-segment',
@@ -332,7 +320,6 @@ test('Should get duration of AV1 video', async () => {
keyframe: false,
lacing: [0, 0],
invisible: false,
- children: null,
},
{
type: 'simple-block-segment',
@@ -343,7 +330,6 @@ test('Should get duration of AV1 video', async () => {
keyframe: false,
lacing: [0, 0],
invisible: false,
- children: null,
},
{
type: 'simple-block-segment',
@@ -354,7 +340,6 @@ test('Should get duration of AV1 video', async () => {
keyframe: false,
lacing: [0, 0],
invisible: false,
- children: null,
},
{
type: 'simple-block-segment',
@@ -365,7 +350,6 @@ test('Should get duration of AV1 video', async () => {
keyframe: false,
lacing: [0, 0],
invisible: false,
- children: null,
},
{
type: 'simple-block-segment',
@@ -376,7 +360,6 @@ test('Should get duration of AV1 video', async () => {
keyframe: false,
lacing: [0, 0],
invisible: false,
- children: null,
},
{
type: 'simple-block-segment',
@@ -387,7 +370,6 @@ test('Should get duration of AV1 video', async () => {
keyframe: false,
lacing: [0, 0],
invisible: false,
- children: null,
},
{
type: 'simple-block-segment',
@@ -398,7 +380,6 @@ test('Should get duration of AV1 video', async () => {
keyframe: false,
lacing: [0, 0],
invisible: false,
- children: null,
},
{
type: 'simple-block-segment',
@@ -409,7 +390,6 @@ test('Should get duration of AV1 video', async () => {
keyframe: false,
lacing: [0, 0],
invisible: false,
- children: null,
},
{
type: 'simple-block-segment',
@@ -420,7 +400,6 @@ test('Should get duration of AV1 video', async () => {
keyframe: false,
lacing: [0, 0],
invisible: false,
- children: null,
},
{
type: 'simple-block-segment',
@@ -431,7 +410,6 @@ test('Should get duration of AV1 video', async () => {
keyframe: false,
lacing: [0, 0],
invisible: false,
- children: null,
},
{
type: 'simple-block-segment',
@@ -442,7 +420,6 @@ test('Should get duration of AV1 video', async () => {
keyframe: false,
lacing: [0, 0],
invisible: false,
- children: null,
},
{
type: 'simple-block-segment',
@@ -453,7 +430,6 @@ test('Should get duration of AV1 video', async () => {
keyframe: false,
lacing: [0, 0],
invisible: false,
- children: null,
},
{
type: 'simple-block-segment',
@@ -464,7 +440,6 @@ test('Should get duration of AV1 video', async () => {
keyframe: false,
lacing: [0, 0],
invisible: false,
- children: null,
},
],
},
diff --git a/packages/media-parser/src/test/stsd.test.ts b/packages/media-parser/src/test/stsd.test.ts
index 97088206fc..a476e93118 100644
--- a/packages/media-parser/src/test/stsd.test.ts
+++ b/packages/media-parser/src/test/stsd.test.ts
@@ -45,6 +45,7 @@ test('Should be able to parse a STSD audio box correctly', () => {
canSkipVideoData: true,
onAudioSample: null,
onVideoSample: null,
+ onSimpleBlock: () => undefined,
},
});
@@ -191,6 +192,7 @@ test('Should be able to parse a STSD video box correctly', () => {
canSkipVideoData: true,
onAudioSample: null,
onVideoSample: null,
+ onSimpleBlock: () => undefined,
},
});
expect(parsed.sample).toEqual({