@remotion/media 4.0.447 → 4.0.448
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.
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare class AudioDecodeScheduler {
|
|
2
|
+
private activeTurns;
|
|
3
|
+
private nextId;
|
|
4
|
+
private queue;
|
|
5
|
+
private pendingBatch;
|
|
6
|
+
private batchTimer;
|
|
7
|
+
requestTurn(priority: number): Promise<number>;
|
|
8
|
+
releaseTurn(id: number): void;
|
|
9
|
+
private processBatch;
|
|
10
|
+
private grant;
|
|
11
|
+
private getMinActivePriority;
|
|
12
|
+
private grantEligibleWaiters;
|
|
13
|
+
}
|
|
14
|
+
export declare const getAudioDecodeScheduler: (audioContext: AudioContext) => AudioDecodeScheduler;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const TARGET_NUMBER_OF_CHANNELS = 2;
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const getTargetSampleRate: () => number;
|
|
3
3
|
export declare const resampleAudioData: ({ srcNumberOfChannels, sourceChannels, destination, targetFrames, chunkSize, }: {
|
|
4
4
|
srcNumberOfChannels: number;
|
|
5
5
|
sourceChannels: Int16Array<ArrayBufferLike>;
|
package/dist/esm/index.mjs
CHANGED
|
@@ -381,7 +381,7 @@ var isAlreadyQueued = (time, queuedPeriod) => {
|
|
|
381
381
|
|
|
382
382
|
// src/make-iterator-with-priming.ts
|
|
383
383
|
var AUDIO_PRIMING_SECONDS = 0.5;
|
|
384
|
-
var PREDECODE_AHEAD_SECONDS =
|
|
384
|
+
var PREDECODE_AHEAD_SECONDS = 2;
|
|
385
385
|
function makePredecodingIterator(inner) {
|
|
386
386
|
const buffer = [];
|
|
387
387
|
let consumerEndTime = 0;
|
|
@@ -564,7 +564,7 @@ var makePrewarmedAudioIteratorCache = (audioSink) => {
|
|
|
564
564
|
};
|
|
565
565
|
|
|
566
566
|
// src/audio-iterator-manager.ts
|
|
567
|
-
var MAX_BUFFER_AHEAD_SECONDS =
|
|
567
|
+
var MAX_BUFFER_AHEAD_SECONDS = 2;
|
|
568
568
|
var audioIteratorManager = ({
|
|
569
569
|
audioTrack,
|
|
570
570
|
delayPlaybackHandleIfNotPremounting,
|
|
@@ -3261,7 +3261,12 @@ var applyVolume = (array, volume) => {
|
|
|
3261
3261
|
|
|
3262
3262
|
// src/convert-audiodata/resample-audiodata.ts
|
|
3263
3263
|
var TARGET_NUMBER_OF_CHANNELS = 2;
|
|
3264
|
-
var
|
|
3264
|
+
var getTargetSampleRate = () => {
|
|
3265
|
+
if (typeof window !== "undefined" && window.remotion_sampleRate) {
|
|
3266
|
+
return window.remotion_sampleRate;
|
|
3267
|
+
}
|
|
3268
|
+
return 48000;
|
|
3269
|
+
};
|
|
3265
3270
|
var fixFloatingPoint = (value) => {
|
|
3266
3271
|
if (value % 1 < 0.0000001) {
|
|
3267
3272
|
return Math.floor(value);
|
|
@@ -3394,7 +3399,7 @@ var convertAudioData = ({
|
|
|
3394
3399
|
sampleRate: currentSampleRate,
|
|
3395
3400
|
numberOfFrames
|
|
3396
3401
|
} = audioData;
|
|
3397
|
-
const ratio = currentSampleRate /
|
|
3402
|
+
const ratio = currentSampleRate / getTargetSampleRate();
|
|
3398
3403
|
const frameOffset = Math.floor(fixFloatingPoint2(trimStartInSeconds * audioData.sampleRate));
|
|
3399
3404
|
const unroundedFrameCount = numberOfFrames - trimEndInSeconds * audioData.sampleRate - frameOffset;
|
|
3400
3405
|
const frameCount = isLast ? ceilButNotIfFloatingPointIssue(unroundedFrameCount) : Math.round(unroundedFrameCount);
|
|
@@ -3441,7 +3446,7 @@ var convertAudioData = ({
|
|
|
3441
3446
|
data: srcChannels,
|
|
3442
3447
|
numberOfFrames: newNumberOfFrames,
|
|
3443
3448
|
timestamp: audioDataTimestamp * 1e6 + fixFloatingPoint2(timestampOffsetMicroseconds),
|
|
3444
|
-
durationInMicroSeconds: fixFloatingPoint2(newNumberOfFrames /
|
|
3449
|
+
durationInMicroSeconds: fixFloatingPoint2(newNumberOfFrames / getTargetSampleRate() * 1e6)
|
|
3445
3450
|
};
|
|
3446
3451
|
}
|
|
3447
3452
|
resampleAudioData({
|
|
@@ -3455,7 +3460,7 @@ var convertAudioData = ({
|
|
|
3455
3460
|
data,
|
|
3456
3461
|
numberOfFrames: newNumberOfFrames,
|
|
3457
3462
|
timestamp: audioDataTimestamp * 1e6 + fixFloatingPoint2(timestampOffsetMicroseconds),
|
|
3458
|
-
durationInMicroSeconds: fixFloatingPoint2(newNumberOfFrames /
|
|
3463
|
+
durationInMicroSeconds: fixFloatingPoint2(newNumberOfFrames / getTargetSampleRate() * 1e6)
|
|
3459
3464
|
};
|
|
3460
3465
|
return newAudioData;
|
|
3461
3466
|
};
|
|
@@ -3727,12 +3732,12 @@ var extractAudioInternal = async ({
|
|
|
3727
3732
|
if (isFirstSample) {
|
|
3728
3733
|
trimStartInSeconds = fixFloatingPoint2(timeInSeconds - sample.timestamp);
|
|
3729
3734
|
if (trimStartInSeconds < 0) {
|
|
3730
|
-
const silenceFrames = Math.ceil(fixFloatingPoint2(-trimStartInSeconds *
|
|
3735
|
+
const silenceFrames = Math.ceil(fixFloatingPoint2(-trimStartInSeconds * getTargetSampleRate()));
|
|
3731
3736
|
leadingSilence = {
|
|
3732
3737
|
data: new Int16Array(silenceFrames * TARGET_NUMBER_OF_CHANNELS),
|
|
3733
3738
|
numberOfFrames: silenceFrames,
|
|
3734
3739
|
timestamp: timeInSeconds * 1e6,
|
|
3735
|
-
durationInMicroSeconds: silenceFrames /
|
|
3740
|
+
durationInMicroSeconds: silenceFrames / getTargetSampleRate() * 1e6
|
|
3736
3741
|
};
|
|
3737
3742
|
trimStartInSeconds = 0;
|
|
3738
3743
|
}
|
|
@@ -4383,7 +4388,7 @@ var AudioForRendering = ({
|
|
|
4383
4388
|
audio: environment.isClientSideRendering ? audio.data : Array.from(audio.data),
|
|
4384
4389
|
frame: absoluteFrame,
|
|
4385
4390
|
timestamp: audio.timestamp,
|
|
4386
|
-
duration: audio.numberOfFrames /
|
|
4391
|
+
duration: audio.numberOfFrames / getTargetSampleRate() * 1e6,
|
|
4387
4392
|
toneFrequency: toneFrequency ?? 1
|
|
4388
4393
|
});
|
|
4389
4394
|
}
|
|
@@ -5153,7 +5158,7 @@ var VideoForRendering = ({
|
|
|
5153
5158
|
audio: environment.isClientSideRendering ? audio.data : Array.from(audio.data),
|
|
5154
5159
|
frame: absoluteFrame,
|
|
5155
5160
|
timestamp: audio.timestamp,
|
|
5156
|
-
duration: audio.numberOfFrames /
|
|
5161
|
+
duration: audio.numberOfFrames / getTargetSampleRate() * 1e6,
|
|
5157
5162
|
toneFrequency
|
|
5158
5163
|
});
|
|
5159
5164
|
}
|
|
@@ -5505,6 +5510,7 @@ Internals23.addSequenceStackTraces(Video);
|
|
|
5505
5510
|
var experimental_Audio = Audio;
|
|
5506
5511
|
var experimental_Video = Video;
|
|
5507
5512
|
export {
|
|
5513
|
+
getTargetSampleRate,
|
|
5508
5514
|
experimental_Video,
|
|
5509
5515
|
experimental_Audio,
|
|
5510
5516
|
Video,
|
package/dist/index.d.ts
CHANGED
|
@@ -48,4 +48,5 @@ export { AudioForPreview } from './audio/audio-for-preview';
|
|
|
48
48
|
export { AudioProps, FallbackHtml5AudioProps } from './audio/props';
|
|
49
49
|
export { MediaErrorAction } from './on-error';
|
|
50
50
|
export { FallbackOffthreadVideoProps, VideoObjectFit, VideoProps, } from './video/props';
|
|
51
|
+
export { getTargetSampleRate } from './convert-audiodata/resample-audiodata';
|
|
51
52
|
export { Audio, Video };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remotion/media",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.448",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"module": "dist/esm/index.mjs",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"mediabunny": "1.39.2",
|
|
26
|
-
"remotion": "4.0.
|
|
26
|
+
"remotion": "4.0.448",
|
|
27
27
|
"zod": "4.3.6"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"react-dom": ">=16.8.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@remotion/eslint-config-internal": "4.0.
|
|
34
|
+
"@remotion/eslint-config-internal": "4.0.448",
|
|
35
35
|
"@vitest/browser-webdriverio": "4.0.9",
|
|
36
36
|
"eslint": "9.19.0",
|
|
37
37
|
"react": "19.2.3",
|