@remotion/media-utils 4.0.527 → 4.0.529
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/dist/esm/index.mjs
CHANGED
|
@@ -528,10 +528,10 @@ var getWaveformPortion = ({
|
|
|
528
528
|
const waveform = audioData.channelWaveforms[channel];
|
|
529
529
|
const startSample = Math.floor((startTimeInSeconds - (dataOffsetInSeconds ?? 0)) * audioData.sampleRate);
|
|
530
530
|
const endSample = Math.floor((startTimeInSeconds - (dataOffsetInSeconds ?? 0) + durationInSeconds) * audioData.sampleRate);
|
|
531
|
-
const samplesBeforeStart = 0 - startSample;
|
|
532
|
-
const samplesAfterEnd = endSample - waveform.length;
|
|
533
|
-
const clampedStart = Math.max(startSample, 0);
|
|
534
|
-
const clampedEnd = Math.min(
|
|
531
|
+
const samplesBeforeStart = Math.min(endSample, 0) - startSample;
|
|
532
|
+
const samplesAfterEnd = endSample - Math.max(startSample, waveform.length);
|
|
533
|
+
const clampedStart = Math.min(Math.max(startSample, 0), waveform.length);
|
|
534
|
+
const clampedEnd = Math.min(Math.max(endSample, 0), waveform.length);
|
|
535
535
|
const padStart = samplesBeforeStart > 0 ? new Float32Array(samplesBeforeStart).fill(0) : null;
|
|
536
536
|
const padEnd = samplesAfterEnd > 0 ? new Float32Array(samplesAfterEnd).fill(0) : null;
|
|
537
537
|
const arrs = [
|
|
@@ -27,10 +27,12 @@ const getWaveformPortion = ({ audioData, startTimeInSeconds, durationInSeconds,
|
|
|
27
27
|
const startSample = Math.floor((startTimeInSeconds - (dataOffsetInSeconds !== null && dataOffsetInSeconds !== void 0 ? dataOffsetInSeconds : 0)) * audioData.sampleRate);
|
|
28
28
|
const endSample = Math.floor((startTimeInSeconds - (dataOffsetInSeconds !== null && dataOffsetInSeconds !== void 0 ? dataOffsetInSeconds : 0) + durationInSeconds) *
|
|
29
29
|
audioData.sampleRate);
|
|
30
|
-
|
|
31
|
-
const
|
|
32
|
-
const
|
|
33
|
-
|
|
30
|
+
// Only pad the part of the requested window that lies outside the audio
|
|
31
|
+
const samplesBeforeStart = Math.min(endSample, 0) - startSample;
|
|
32
|
+
const samplesAfterEnd = endSample - Math.max(startSample, waveform.length);
|
|
33
|
+
// A negative slice index would count from the end and leak real audio
|
|
34
|
+
const clampedStart = Math.min(Math.max(startSample, 0), waveform.length);
|
|
35
|
+
const clampedEnd = Math.min(Math.max(endSample, 0), waveform.length);
|
|
34
36
|
const padStart = samplesBeforeStart > 0
|
|
35
37
|
? new Float32Array(samplesBeforeStart).fill(0)
|
|
36
38
|
: null;
|
package/package.json
CHANGED
|
@@ -3,14 +3,15 @@
|
|
|
3
3
|
"url": "https://github.com/remotion-dev/remotion/tree/main/packages/media-utils"
|
|
4
4
|
},
|
|
5
5
|
"name": "@remotion/media-utils",
|
|
6
|
-
"version": "4.0.
|
|
6
|
+
"version": "4.0.529",
|
|
7
7
|
"description": "Utilities for working with media files",
|
|
8
8
|
"main": "dist/index.js",
|
|
9
9
|
"scripts": {
|
|
10
10
|
"formatting": "oxfmt src --check",
|
|
11
11
|
"format": "oxfmt src",
|
|
12
12
|
"lint": "eslint src",
|
|
13
|
-
"make": "tsgo -d && bun --env-file=../.env.bundle bundle.ts"
|
|
13
|
+
"make": "tsgo -d && bun --env-file=../.env.bundle bundle.ts",
|
|
14
|
+
"test": "bun test src"
|
|
14
15
|
},
|
|
15
16
|
"types": "dist/index.d.ts",
|
|
16
17
|
"module": "dist/esm/index.mjs",
|
|
@@ -20,7 +21,7 @@
|
|
|
20
21
|
"url": "https://github.com/remotion-dev/remotion/issues"
|
|
21
22
|
},
|
|
22
23
|
"dependencies": {
|
|
23
|
-
"remotion": "4.0.
|
|
24
|
+
"remotion": "4.0.529",
|
|
24
25
|
"mediabunny": "1.56.1"
|
|
25
26
|
},
|
|
26
27
|
"peerDependencies": {
|
|
@@ -28,7 +29,7 @@
|
|
|
28
29
|
"react-dom": ">=16.8.0"
|
|
29
30
|
},
|
|
30
31
|
"devDependencies": {
|
|
31
|
-
"@remotion/eslint-config-internal": "4.0.
|
|
32
|
+
"@remotion/eslint-config-internal": "4.0.529",
|
|
32
33
|
"eslint": "9.19.0",
|
|
33
34
|
"@typescript/native-preview": "7.0.0-dev.20260217.1"
|
|
34
35
|
},
|