Skip to content

🎥 Make videos programmatically with React

Update keyframe-manager.ts

Jonny Burgere85cb8d72bde
diff --git a/packages/video/src/keyframe-manager.ts b/packages/video/src/keyframe-manager.ts
index 228f26925d..b84f07120c 100644
--- a/packages/video/src/keyframe-manager.ts
+++ b/packages/video/src/keyframe-manager.ts
@@ -61,7 +61,21 @@ export const makeKeyframeManager = () => {
const SAFE_BACK_WINDOW_IN_SECONDS = 1;
const threshold = timestampInSeconds - SAFE_BACK_WINDOW_IN_SECONDS;
- // TODO: Delete banks of other sources
+ const keys = Object.keys(sources);
+ for (const key of keys) {
+ if (key === src) {
+ continue;
+ }
+
+ const otherBanks = Object.keys(sources[key]);
+ for (const b of otherBanks) {
+ const bank = await sources[key][b as unknown as number];
+ const {endTimestampInSeconds} = bank;
+ if (endTimestampInSeconds < threshold) {
+ await bank.prepareForDeletion();
+ }
+ }
+ }
if (!sources[src]) {
return;