Skip to content

🎥 Make videos programmatically with React

Update extract-frames.ts

JonnyBurger5fcdba7fc4ae
diff --git a/packages/webcodecs/src/extract-frames.ts b/packages/webcodecs/src/extract-frames.ts
index 3769222209..ce2b240737 100644
--- a/packages/webcodecs/src/extract-frames.ts
+++ b/packages/webcodecs/src/extract-frames.ts
@@ -100,8 +100,8 @@ const internalExtractFrames = ({
// A WebM might have a timestamp of 67000 but we request 66666
// See a test with this problem in it-tests/rendering/frame-accuracy.test.ts
- // Solution: We allow a 0.1000ms - 0.333ms = 0.667ms difference between the requested timestamp and the actual timestamp
- if (expectedFrames[0] + (1000 - 333) < frame.timestamp && lastFrame) {
+ // Solution: We allow a 10.000ms - 3.333ms = 6.667ms difference between the requested timestamp and the actual timestamp
+ if (expectedFrames[0] + 6667 < frame.timestamp && lastFrame) {
onFrame(lastFrame);
expectedFrames.shift();