@microfox/remotion 1.2.3 → 1.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +74 -31
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +74 -31
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.2.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 4b2846e: Changes from PR #375: aws-rendering-configs
|
|
8
|
+
- d3fafd6: Changes from PR #377: agent-search-and-preset-sharing
|
|
9
|
+
|
|
10
|
+
## 1.2.4
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- 320390f: Changes from PR #371: gen-images-sets
|
|
15
|
+
|
|
3
16
|
## 1.2.3
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -1282,6 +1282,7 @@ interface WaveformHistogramDataProps {
|
|
|
1282
1282
|
waveDirection?: 'right-to-left' | 'left-to-right';
|
|
1283
1283
|
histogramStyle?: 'centered' | 'full-width';
|
|
1284
1284
|
amplitude?: number;
|
|
1285
|
+
barSlant?: number;
|
|
1285
1286
|
gradientStartColor?: string;
|
|
1286
1287
|
gradientEndColor?: string;
|
|
1287
1288
|
gradientDirection?: 'vertical' | 'horizontal';
|
|
@@ -1306,6 +1307,7 @@ interface WaveformHistogramRangedDataProps {
|
|
|
1306
1307
|
histogramStyle?: 'centered' | 'full-width';
|
|
1307
1308
|
waveDirection?: 'right-to-left' | 'left-to-right';
|
|
1308
1309
|
amplitude?: number;
|
|
1310
|
+
barSlant?: number;
|
|
1309
1311
|
showFrequencyRanges?: boolean;
|
|
1310
1312
|
rangeDividerColor?: string;
|
|
1311
1313
|
rangeLabels?: boolean;
|
package/dist/index.d.ts
CHANGED
|
@@ -1282,6 +1282,7 @@ interface WaveformHistogramDataProps {
|
|
|
1282
1282
|
waveDirection?: 'right-to-left' | 'left-to-right';
|
|
1283
1283
|
histogramStyle?: 'centered' | 'full-width';
|
|
1284
1284
|
amplitude?: number;
|
|
1285
|
+
barSlant?: number;
|
|
1285
1286
|
gradientStartColor?: string;
|
|
1286
1287
|
gradientEndColor?: string;
|
|
1287
1288
|
gradientDirection?: 'vertical' | 'horizontal';
|
|
@@ -1306,6 +1307,7 @@ interface WaveformHistogramRangedDataProps {
|
|
|
1306
1307
|
histogramStyle?: 'centered' | 'full-width';
|
|
1307
1308
|
waveDirection?: 'right-to-left' | 'left-to-right';
|
|
1308
1309
|
amplitude?: number;
|
|
1310
|
+
barSlant?: number;
|
|
1309
1311
|
showFrequencyRanges?: boolean;
|
|
1310
1312
|
rangeDividerColor?: string;
|
|
1311
1313
|
rangeLabels?: boolean;
|
package/dist/index.js
CHANGED
|
@@ -225,6 +225,13 @@ var useComposition = () => {
|
|
|
225
225
|
|
|
226
226
|
// src/core/context/timing.ts
|
|
227
227
|
var import_mediabunny = require("mediabunny");
|
|
228
|
+
var durationCache = /* @__PURE__ */ new Map();
|
|
229
|
+
var getDurationCacheKey = (src, startFrom, endAt, playbackRate) => {
|
|
230
|
+
const startFromStr = startFrom === void 0 ? "undefined" : String(startFrom);
|
|
231
|
+
const endAtStr = endAt === void 0 ? "undefined" : String(endAt);
|
|
232
|
+
const playbackRateStr = playbackRate === void 0 ? "1" : String(playbackRate);
|
|
233
|
+
return `${src}|${startFromStr}|${endAtStr}|${playbackRateStr}`;
|
|
234
|
+
};
|
|
228
235
|
var findMatchingComponents = (childrenData, targetIds) => {
|
|
229
236
|
const matches = [];
|
|
230
237
|
const searchRecursively = (components) => {
|
|
@@ -267,19 +274,29 @@ var findMatchingComponentsByQuery = (childrenData, query) => {
|
|
|
267
274
|
};
|
|
268
275
|
var calculateComponentDuration = async (component) => {
|
|
269
276
|
const src = component.data.src;
|
|
270
|
-
if (src
|
|
271
|
-
const
|
|
272
|
-
|
|
273
|
-
source: new import_mediabunny.UrlSource(src)
|
|
274
|
-
});
|
|
275
|
-
const audioDuration = await audioInput.computeDuration();
|
|
276
|
-
let trimmedDuration = audioDuration;
|
|
277
|
-
if (component.data.startFrom || component.data.endAt) {
|
|
278
|
-
trimmedDuration = audioDuration - (component.data.startFrom || 0) - (component.data.endAt ? audioDuration - (component.data.endAt || 0) : 0);
|
|
279
|
-
}
|
|
277
|
+
if (src?.startsWith("http")) {
|
|
278
|
+
const startFrom = component.data.startFrom;
|
|
279
|
+
const endAt = component.data.endAt;
|
|
280
280
|
const playbackRate = component.data.playbackRate || 1;
|
|
281
|
-
const
|
|
282
|
-
|
|
281
|
+
const cacheKey = getDurationCacheKey(src, startFrom, endAt, playbackRate);
|
|
282
|
+
if (durationCache.has(cacheKey)) {
|
|
283
|
+
return durationCache.get(cacheKey);
|
|
284
|
+
}
|
|
285
|
+
const calculationPromise = (async () => {
|
|
286
|
+
const audioInput = new import_mediabunny.Input({
|
|
287
|
+
formats: import_mediabunny.ALL_FORMATS,
|
|
288
|
+
source: new import_mediabunny.UrlSource(src)
|
|
289
|
+
});
|
|
290
|
+
const audioDuration = await audioInput.computeDuration();
|
|
291
|
+
let trimmedDuration = audioDuration;
|
|
292
|
+
if (startFrom || endAt) {
|
|
293
|
+
trimmedDuration = audioDuration - (startFrom || 0) - (endAt ? audioDuration - (endAt || 0) : 0);
|
|
294
|
+
}
|
|
295
|
+
const effectiveDuration = trimmedDuration / playbackRate;
|
|
296
|
+
return effectiveDuration;
|
|
297
|
+
})();
|
|
298
|
+
durationCache.set(cacheKey, calculationPromise);
|
|
299
|
+
return calculationPromise;
|
|
283
300
|
} else {
|
|
284
301
|
}
|
|
285
302
|
};
|
|
@@ -292,9 +309,13 @@ var calculateDuration = async (childrenData, config18) => {
|
|
|
292
309
|
);
|
|
293
310
|
if (matchingComponents.length === 1) {
|
|
294
311
|
if (matchingComponents[0].type === "atom" && (matchingComponents[0].componentId === "AudioAtom" || matchingComponents[0].componentId === "VideoAtom")) {
|
|
295
|
-
|
|
296
|
-
matchingComponents[0]
|
|
297
|
-
|
|
312
|
+
if (matchingComponents[0].context?.timing?.duration) {
|
|
313
|
+
calculatedDuration = matchingComponents[0].context.timing.duration;
|
|
314
|
+
} else {
|
|
315
|
+
calculatedDuration = await calculateComponentDuration(
|
|
316
|
+
matchingComponents[0]
|
|
317
|
+
);
|
|
318
|
+
}
|
|
298
319
|
}
|
|
299
320
|
if ((matchingComponents[0].type === "scene" || matchingComponents[0].type === "layout") && matchingComponents[0].context?.timing?.duration) {
|
|
300
321
|
calculatedDuration = matchingComponents[0].context.timing.duration;
|
|
@@ -303,6 +324,7 @@ var calculateDuration = async (childrenData, config18) => {
|
|
|
303
324
|
return calculatedDuration;
|
|
304
325
|
};
|
|
305
326
|
var setDurationsInContext = async (root) => {
|
|
327
|
+
durationCache.clear();
|
|
306
328
|
const iterateRecursively = async (components, onlyScene = false) => {
|
|
307
329
|
const updatedComponents = [];
|
|
308
330
|
for (const component of components) {
|
|
@@ -314,12 +336,15 @@ var setDurationsInContext = async (root) => {
|
|
|
314
336
|
);
|
|
315
337
|
}
|
|
316
338
|
if (updatedComponent.context?.timing?.fitDurationTo?.length > 0 && !onlyScene && updatedComponent.context?.timing?.fitDurationTo != updatedComponent.id && updatedComponent.context?.timing?.fitDurationTo != "this" && updatedComponent.context?.timing?.fitDurationTo != "fill") {
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
339
|
+
let duration = updatedComponent.context?.timing?.duration;
|
|
340
|
+
if (!duration) {
|
|
341
|
+
duration = await calculateDuration(
|
|
342
|
+
updatedComponent.childrenData,
|
|
343
|
+
{
|
|
344
|
+
fitDurationTo: updatedComponent.context?.timing?.fitDurationTo
|
|
345
|
+
}
|
|
346
|
+
);
|
|
347
|
+
}
|
|
323
348
|
updatedComponent = {
|
|
324
349
|
...updatedComponent,
|
|
325
350
|
context: {
|
|
@@ -342,6 +367,8 @@ var setDurationsInContext = async (root) => {
|
|
|
342
367
|
(acc, child) => acc + (child.context?.timing?.duration ?? 0),
|
|
343
368
|
0
|
|
344
369
|
) ?? 10;
|
|
370
|
+
} else {
|
|
371
|
+
duration = updatedComponent.context.timing.duration;
|
|
345
372
|
}
|
|
346
373
|
if (duration !== void 0) {
|
|
347
374
|
updatedComponent.context = {
|
|
@@ -355,7 +382,13 @@ var setDurationsInContext = async (root) => {
|
|
|
355
382
|
}
|
|
356
383
|
if (updatedComponent.type === "atom" && !onlyScene) {
|
|
357
384
|
if (updatedComponent.componentId === "VideoAtom" || updatedComponent.componentId === "AudioAtom") {
|
|
358
|
-
const
|
|
385
|
+
const needsDurationCalculation = !updatedComponent.context?.timing?.duration || updatedComponent.data?.loop && !updatedComponent.data?.srcDuration;
|
|
386
|
+
let mediaDuration;
|
|
387
|
+
if (needsDurationCalculation) {
|
|
388
|
+
mediaDuration = await calculateComponentDuration(updatedComponent);
|
|
389
|
+
} else {
|
|
390
|
+
mediaDuration = updatedComponent.context?.timing?.duration;
|
|
391
|
+
}
|
|
359
392
|
if (!updatedComponent.context?.timing?.fitDurationTo) {
|
|
360
393
|
updatedComponent.context = {
|
|
361
394
|
...updatedComponent.context || {},
|
|
@@ -366,9 +399,9 @@ var setDurationsInContext = async (root) => {
|
|
|
366
399
|
};
|
|
367
400
|
updatedComponent.data = {
|
|
368
401
|
...updatedComponent.data,
|
|
369
|
-
...updatedComponent.data.loop ? { srcDuration: mediaDuration } : {}
|
|
402
|
+
...updatedComponent.data.loop && mediaDuration ? { srcDuration: mediaDuration } : {}
|
|
370
403
|
};
|
|
371
|
-
} else if (updatedComponent.context?.timing?.fitDurationTo) {
|
|
404
|
+
} else if (updatedComponent.context?.timing?.fitDurationTo && mediaDuration) {
|
|
372
405
|
updatedComponent.data = {
|
|
373
406
|
...updatedComponent.data,
|
|
374
407
|
srcDuration: mediaDuration
|
|
@@ -5372,6 +5405,7 @@ var WaveformHistogram = ({ data }) => {
|
|
|
5372
5405
|
histogramStyle = "centered",
|
|
5373
5406
|
amplitude = 1,
|
|
5374
5407
|
multiplier = 1,
|
|
5408
|
+
barSlant = 0,
|
|
5375
5409
|
gradientStartColor,
|
|
5376
5410
|
gradientEndColor,
|
|
5377
5411
|
gradientDirection = "vertical",
|
|
@@ -5395,7 +5429,8 @@ var WaveformHistogram = ({ data }) => {
|
|
|
5395
5429
|
gradientDirection,
|
|
5396
5430
|
multiplier,
|
|
5397
5431
|
gradientStyle,
|
|
5398
|
-
waveDirection
|
|
5432
|
+
waveDirection,
|
|
5433
|
+
barSlant
|
|
5399
5434
|
}
|
|
5400
5435
|
));
|
|
5401
5436
|
};
|
|
@@ -5414,7 +5449,8 @@ var WaveformHistogramContent = ({
|
|
|
5414
5449
|
gradientDirection,
|
|
5415
5450
|
multiplier,
|
|
5416
5451
|
gradientStyle,
|
|
5417
|
-
waveDirection
|
|
5452
|
+
waveDirection,
|
|
5453
|
+
barSlant
|
|
5418
5454
|
}) => {
|
|
5419
5455
|
const { waveformData, frequencyData, amplitudes, width, height } = useWaveformContext();
|
|
5420
5456
|
const dataToUse = amplitudes || waveformData;
|
|
@@ -5455,7 +5491,9 @@ var WaveformHistogramContent = ({
|
|
|
5455
5491
|
Math.abs(value) * (height / 2) * (amplitude || 1)
|
|
5456
5492
|
)}px`,
|
|
5457
5493
|
borderRadius: growUpwards ? `${barBorderRadius}px ${barBorderRadius}px 0 0` : `0 0 ${barBorderRadius}px ${barBorderRadius}px`,
|
|
5458
|
-
opacity
|
|
5494
|
+
opacity,
|
|
5495
|
+
transform: barSlant ? `rotate(${barSlant}deg)` : void 0,
|
|
5496
|
+
transformOrigin: "center bottom"
|
|
5459
5497
|
}
|
|
5460
5498
|
}
|
|
5461
5499
|
)));
|
|
@@ -5513,7 +5551,8 @@ var WaveformHistogramRanged = ({ data }) => {
|
|
|
5513
5551
|
gradientDirection = "vertical",
|
|
5514
5552
|
gradientStyle = "normal",
|
|
5515
5553
|
horizontalSymmetry = false,
|
|
5516
|
-
waveDirection = "right-to-left"
|
|
5554
|
+
waveDirection = "right-to-left",
|
|
5555
|
+
barSlant = 0
|
|
5517
5556
|
} = data;
|
|
5518
5557
|
return /* @__PURE__ */ import_react40.default.createElement(Waveform, { config: config18, className, style }, /* @__PURE__ */ import_react40.default.createElement(
|
|
5519
5558
|
WaveformHistogramRangedContent,
|
|
@@ -5537,7 +5576,8 @@ var WaveformHistogramRanged = ({ data }) => {
|
|
|
5537
5576
|
gradientDirection,
|
|
5538
5577
|
gradientStyle,
|
|
5539
5578
|
horizontalSymmetry,
|
|
5540
|
-
waveDirection
|
|
5579
|
+
waveDirection,
|
|
5580
|
+
barSlant
|
|
5541
5581
|
}
|
|
5542
5582
|
));
|
|
5543
5583
|
};
|
|
@@ -5561,7 +5601,8 @@ var WaveformHistogramRangedContent = ({
|
|
|
5561
5601
|
gradientDirection,
|
|
5562
5602
|
gradientStyle,
|
|
5563
5603
|
horizontalSymmetry,
|
|
5564
|
-
waveDirection
|
|
5604
|
+
waveDirection,
|
|
5605
|
+
barSlant
|
|
5565
5606
|
}) => {
|
|
5566
5607
|
const { amplitudes, bassValues, midValues, trebleValues, height } = useWaveformContext();
|
|
5567
5608
|
if (!amplitudes || !bassValues || !midValues || !trebleValues) {
|
|
@@ -5608,7 +5649,9 @@ var WaveformHistogramRangedContent = ({
|
|
|
5608
5649
|
)}px`,
|
|
5609
5650
|
borderRadius: growUpwards ? `${barBorderRadius}px ${barBorderRadius}px 0 0` : `0 0 ${barBorderRadius}px ${barBorderRadius}px`,
|
|
5610
5651
|
opacity,
|
|
5611
|
-
position: "relative"
|
|
5652
|
+
position: "relative",
|
|
5653
|
+
transform: barSlant ? `rotate(${barSlant}deg)` : void 0,
|
|
5654
|
+
transformOrigin: "center bottom"
|
|
5612
5655
|
},
|
|
5613
5656
|
title: `${rangeName}: ${(value * 100).toFixed(1)}%`
|
|
5614
5657
|
},
|