Skip to content

🎥 Make videos programmatically with React

`remotion`: Fix case where `<Video>` would lead to timeout if it is mounted beyond it's duration

Jonny Burger201eb7ebee3b
diff --git a/packages/core/src/video/seek-until-right.ts b/packages/core/src/video/seek-until-right.ts
index 1e40fe3f66..7dd14a3617 100644
--- a/packages/core/src/video/seek-until-right.ts
+++ b/packages/core/src/video/seek-until-right.ts
@@ -50,6 +50,17 @@ export const seekToTimeMultipleUntilRight = (
const threshold = 1 / fps / 2;
let currentCancel: () => void = () => undefined;
+ if (
+ Number.isFinite(element.duration) &&
+ element.currentTime >= element.duration &&
+ desiredTime >= element.duration
+ ) {
+ return {
+ prom: Promise.resolve(),
+ cancel: () => {},
+ };
+ }
+
const prom = new Promise<void>((resolve, reject) => {
const firstSeek = seekToTime(element, desiredTime + threshold);
firstSeek.wait.then((seekedTo) => {