Skip to content

🎥 Make videos programmatically with React

list box

Jonny Burgere189abdf9c5d
diff --git a/packages/media-parser/src/containers/riff/expect-riff-box.ts b/packages/media-parser/src/containers/riff/expect-riff-box.ts
index 24a065d6c0..e9b7b6ad25 100644
--- a/packages/media-parser/src/containers/riff/expect-riff-box.ts
+++ b/packages/media-parser/src/containers/riff/expect-riff-box.ts
@@ -12,7 +12,7 @@ export type RiffResult = {
box: RiffBox | null;
};
-const postProcessRiffBox = async (state: ParserState, box: RiffBox) => {
+export const postProcessRiffBox = async (state: ParserState, box: RiffBox) => {
if (box.type === 'strh-box') {
if (box.strf.type === 'strf-box-audio' && state.onAudioTrack) {
const audioTrack = makeAviAudioTrack({
@@ -82,7 +82,5 @@ export const expectRiffBox = async (
state,
});
- await postProcessRiffBox(state, box);
-
return box;
};
diff --git a/packages/media-parser/src/containers/riff/parse-list-box.ts b/packages/media-parser/src/containers/riff/parse-list-box.ts
index 3f1e3577b2..497ce3ddae 100644
--- a/packages/media-parser/src/containers/riff/parse-list-box.ts
+++ b/packages/media-parser/src/containers/riff/parse-list-box.ts
@@ -1,5 +1,5 @@
import type {ParserState} from '../../state/parser-state';
-import {expectRiffBox} from './expect-riff-box';
+import {expectRiffBox, postProcessRiffBox} from './expect-riff-box';
import type {RiffBox} from './riff-box';
export const parseListBox = async ({
@@ -22,10 +22,13 @@ export const parseListBox = async ({
while (iterator.counter.getOffset() < maxOffset) {
const box = await expectRiffBox(state);
+
if (box === null) {
throw new Error('Unexpected result');
}
+ await postProcessRiffBox(state, box);
+
boxes.push(box);
}
diff --git a/packages/media-parser/src/containers/riff/parse-riff-body.ts b/packages/media-parser/src/containers/riff/parse-riff-body.ts
index ae1c2dbc0f..48cc1b2d74 100644
--- a/packages/media-parser/src/containers/riff/parse-riff-body.ts
+++ b/packages/media-parser/src/containers/riff/parse-riff-body.ts
@@ -3,7 +3,7 @@ import {makeSkip} from '../../skip';
import {maySkipVideoData} from '../../state/may-skip-video-data';
import type {ParserState} from '../../state/parser-state';
import {getCurrentMediaSection} from '../../state/video-section';
-import {expectRiffBox} from './expect-riff-box';
+import {expectRiffBox, postProcessRiffBox} from './expect-riff-box';
import {parseMediaSection} from './parse-video-section';
export const parseRiffBody = async (
@@ -37,6 +37,7 @@ export const parseRiffBody = async (
const box = await expectRiffBox(state);
if (box !== null) {
+ await postProcessRiffBox(state, box);
const structure = state.structure.getRiffStructure();
structure.boxes.push(box);
}
diff --git a/packages/media-parser/src/test/seeking/fetch-idx.test.ts b/packages/media-parser/src/test/seeking/fetch-idx.test.ts
new file mode 100644
index 0000000000..561f1e920a
--- /dev/null
+++ b/packages/media-parser/src/test/seeking/fetch-idx.test.ts
@@ -0,0 +1,17 @@
+import {exampleVideos} from '@remotion/example-videos';
+import {test} from 'bun:test';
+import {fetchIdx1} from '../../containers/riff/seek/fetch-idx1';
+import {mediaParserController} from '../../controller/media-parser-controller';
+import {nodeReader} from '../../node';
+
+test('fetch-idx', async () => {
+ const result = await fetchIdx1({
+ src: exampleVideos.avi,
+ controller: mediaParserController(),
+ logLevel: 'verbose',
+ position: 0xac246,
+ readerInterface: nodeReader,
+ });
+
+ console.log(result);
+});