🎥 Make videos programmatically with React
only skip on 1mb skipahead
Jonny Burger2751ac511a25
diff --git a/packages/media-parser/src/boxes/iso-base-media/process-box.ts b/packages/media-parser/src/boxes/iso-base-media/process-box.tsindex bf1423092b..83a9b02661 100644--- a/packages/media-parser/src/boxes/iso-base-media/process-box.ts+++ b/packages/media-parser/src/boxes/iso-base-media/process-box.ts@@ -73,18 +73,24 @@ const processBox = ({iterator.counter.decrement(4);if (type === 'mdat') {- return {- type: 'complete',- box: {- type: 'regular-box',- boxType: 'mdat',- children: [],- boxSize,- offset: fileOffset,- },- size: boxSize,- skipTo: fileOffset + boxSize,- };+ const skipTo = fileOffset + boxSize;+ const bytesToSkip = skipTo - iterator.counter.getOffset();++ // If there is a huge mdat chunk, we can skip it because we don't need it for the metadata+ if (bytesToSkip > 1_000_000) {+ return {+ type: 'complete',+ box: {+ type: 'regular-box',+ boxType: 'mdat',+ children: [],+ boxSize,+ offset: fileOffset,+ },+ size: boxSize,+ skipTo: fileOffset + boxSize,+ };+ }}}