@remotion/media 4.0.515 → 4.0.517
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/audio-iterator-manager.d.ts +2 -1
- package/dist/esm/index.mjs +32 -13
- package/dist/media-player.d.ts +1 -1
- package/package.json +4 -4
|
@@ -16,7 +16,7 @@ export declare const anchorToContinuousTime: ({ anchor, unloopedTimeInSeconds, p
|
|
|
16
16
|
unloopedTimeInSeconds: number;
|
|
17
17
|
playbackRate: number;
|
|
18
18
|
}) => number;
|
|
19
|
-
export declare const audioIteratorManager: ({ audioTrack, delayPlaybackHandleIfNotPremounting, sharedAudioContext, getSequenceEndTimestamp, getSequenceDurationInSeconds, getMediaEndTimestamp, getStartTime, initialMuted, drawDebugOverlay, }: {
|
|
19
|
+
export declare const audioIteratorManager: ({ audioTrack, delayPlaybackHandleIfNotPremounting, sharedAudioContext, getSequenceEndTimestamp, getSequenceDurationInSeconds, getMediaEndTimestamp, getStartTime, initialMuted, initialVolume, drawDebugOverlay, }: {
|
|
20
20
|
audioTrack: InputAudioTrack;
|
|
21
21
|
delayPlaybackHandleIfNotPremounting: () => DelayPlaybackIfNotPremounting;
|
|
22
22
|
sharedAudioContext: SharedAudioContextForMediaPlayer;
|
|
@@ -25,6 +25,7 @@ export declare const audioIteratorManager: ({ audioTrack, delayPlaybackHandleIfN
|
|
|
25
25
|
getMediaEndTimestamp: () => number;
|
|
26
26
|
getStartTime: () => number;
|
|
27
27
|
initialMuted: boolean;
|
|
28
|
+
initialVolume: number;
|
|
28
29
|
drawDebugOverlay: () => void;
|
|
29
30
|
}) => {
|
|
30
31
|
startAudioIterator: ({ nonce, playbackRate, startFromSecond, unloopedStartFromSecond, scheduleAudioNode, getTargetTime, logLevel, loop, unscheduleAudioNode, getAudioContextCurrentTimeMockedInTest, }: {
|
package/dist/esm/index.mjs
CHANGED
|
@@ -435,12 +435,14 @@ var audioIteratorManager = ({
|
|
|
435
435
|
getMediaEndTimestamp,
|
|
436
436
|
getStartTime,
|
|
437
437
|
initialMuted,
|
|
438
|
+
initialVolume,
|
|
438
439
|
drawDebugOverlay
|
|
439
440
|
}) => {
|
|
440
441
|
let muted = initialMuted;
|
|
441
|
-
let currentVolume =
|
|
442
|
+
let currentVolume = Math.max(0, initialVolume);
|
|
442
443
|
let currentSeek = null;
|
|
443
444
|
const gainNode = sharedAudioContext.audioContext.createGain();
|
|
445
|
+
gainNode.gain.value = muted ? 0 : currentVolume;
|
|
444
446
|
gainNode.connect(sharedAudioContext.gainNode);
|
|
445
447
|
const audioSink = new AudioBufferSink(audioTrack);
|
|
446
448
|
let audioBufferIterator = null;
|
|
@@ -1847,8 +1849,8 @@ class MediaPlayer {
|
|
|
1847
1849
|
isDisposalError() {
|
|
1848
1850
|
return this.disposed || this.input.disposed === true;
|
|
1849
1851
|
}
|
|
1850
|
-
initialize(startTimeUnresolved, initialMuted) {
|
|
1851
|
-
const promise = this._initialize(startTimeUnresolved, initialMuted);
|
|
1852
|
+
initialize(startTimeUnresolved, initialMuted, initialVolume) {
|
|
1853
|
+
const promise = this._initialize(startTimeUnresolved, initialMuted, initialVolume);
|
|
1852
1854
|
this.initializationPromise = promise;
|
|
1853
1855
|
this.seekPromiseChain = promise;
|
|
1854
1856
|
return promise;
|
|
@@ -1875,7 +1877,7 @@ class MediaPlayer {
|
|
|
1875
1877
|
getLoopSegmentMediaEndTimestamp() {
|
|
1876
1878
|
return Math.min(this.getMediaEndTimestamp(), this.getSequenceEndTimestamp());
|
|
1877
1879
|
}
|
|
1878
|
-
async _initialize(startTimeUnresolved, initialMuted) {
|
|
1880
|
+
async _initialize(startTimeUnresolved, initialMuted, initialVolume) {
|
|
1879
1881
|
let __stack = [];
|
|
1880
1882
|
try {
|
|
1881
1883
|
const _ = __using(__stack, this.delayPlaybackHandleIfNotPremounting(), 0);
|
|
@@ -1971,6 +1973,7 @@ class MediaPlayer {
|
|
|
1971
1973
|
getSequenceEndTimestamp: () => this.getSequenceEndTimestamp(),
|
|
1972
1974
|
getStartTime: () => this.getStartTime(),
|
|
1973
1975
|
initialMuted,
|
|
1976
|
+
initialVolume,
|
|
1974
1977
|
drawDebugOverlay: this.drawDebugOverlay,
|
|
1975
1978
|
getSequenceDurationInSeconds: () => this.getSequenceDurationInSeconds()
|
|
1976
1979
|
});
|
|
@@ -2533,6 +2536,7 @@ var AudioForPreviewAssertedShowing = ({
|
|
|
2533
2536
|
const initialGlobalPlaybackRate = useRef(globalPlaybackRate);
|
|
2534
2537
|
const initialPlaybackRate = useRef(playbackRate);
|
|
2535
2538
|
const initialMuted = useRef(effectiveMuted);
|
|
2539
|
+
const initialVolume = useRef(userPreferredVolume);
|
|
2536
2540
|
const initialDurationInFrames = useRef(videoConfig.durationInFrames);
|
|
2537
2541
|
const initialSequenceOffset = useRef(sequenceOffset);
|
|
2538
2542
|
useCommonEffects({
|
|
@@ -2607,7 +2611,7 @@ var AudioForPreviewAssertedShowing = ({
|
|
|
2607
2611
|
getEffectChainState: () => null
|
|
2608
2612
|
});
|
|
2609
2613
|
mediaPlayerRef.current = player;
|
|
2610
|
-
player.initialize(currentTimeRef.current, initialMuted.current).then((result) => {
|
|
2614
|
+
player.initialize(currentTimeRef.current, initialMuted.current, initialVolume.current).then((result) => {
|
|
2611
2615
|
if (result.type === "disposed") {
|
|
2612
2616
|
return;
|
|
2613
2617
|
}
|
|
@@ -4089,6 +4093,9 @@ var fixFloatingPoint = (value) => {
|
|
|
4089
4093
|
}
|
|
4090
4094
|
return value;
|
|
4091
4095
|
};
|
|
4096
|
+
var clampToS16 = (value) => {
|
|
4097
|
+
return Math.max(-32768, Math.min(32767, value));
|
|
4098
|
+
};
|
|
4092
4099
|
var resampleAudioData = ({
|
|
4093
4100
|
srcNumberOfChannels,
|
|
4094
4101
|
sourceChannels,
|
|
@@ -4149,13 +4156,14 @@ var resampleAudioData = ({
|
|
|
4149
4156
|
const l = getSourceValues(start, end, 0);
|
|
4150
4157
|
const r = getSourceValues(start, end, 1);
|
|
4151
4158
|
const c = getSourceValues(start, end, 2);
|
|
4152
|
-
const sl = getSourceValues(start, end,
|
|
4153
|
-
const sr = getSourceValues(start, end,
|
|
4159
|
+
const sl = getSourceValues(start, end, 4);
|
|
4160
|
+
const sr = getSourceValues(start, end, 5);
|
|
4154
4161
|
const sq = Math.sqrt(1 / 2);
|
|
4155
|
-
const
|
|
4156
|
-
const
|
|
4157
|
-
|
|
4158
|
-
destination[newFrameIndex * 2 +
|
|
4162
|
+
const norm = 1 / (1 + sq + sq);
|
|
4163
|
+
const l2 = (l + sq * (c + sl)) * norm;
|
|
4164
|
+
const r2 = (r + sq * (c + sr)) * norm;
|
|
4165
|
+
destination[newFrameIndex * 2 + 0] = clampToS16(l2);
|
|
4166
|
+
destination[newFrameIndex * 2 + 1] = clampToS16(r2);
|
|
4159
4167
|
} else {
|
|
4160
4168
|
for (let i = 0;i < srcNumberOfChannels; i++) {
|
|
4161
4169
|
destination[newFrameIndex * TARGET_NUMBER_OF_CHANNELS + i] = getSourceValues(start, end, i);
|
|
@@ -4785,7 +4793,11 @@ var addBroadcastChannelListener = () => {
|
|
|
4785
4793
|
audio,
|
|
4786
4794
|
durationInSeconds: durationInSeconds ?? null
|
|
4787
4795
|
};
|
|
4788
|
-
|
|
4796
|
+
try {
|
|
4797
|
+
window.remotion_broadcastChannel.postMessage(response);
|
|
4798
|
+
} finally {
|
|
4799
|
+
imageBitmap?.close();
|
|
4800
|
+
}
|
|
4789
4801
|
} catch (error) {
|
|
4790
4802
|
const response = {
|
|
4791
4803
|
type: "response-error",
|
|
@@ -5004,6 +5016,7 @@ var AudioForRendering = ({
|
|
|
5004
5016
|
const [replaceWithHtml5Audio, setReplaceWithHtml5Audio] = useState2(false);
|
|
5005
5017
|
const [initialRequestInit] = useState2(requestInit);
|
|
5006
5018
|
const sequenceContext = useContext3(Internals18.SequenceContext);
|
|
5019
|
+
const startInVideo = sequenceContext ? sequenceContext.cumulatedFrom + sequenceContext.relativeFrom : 0;
|
|
5007
5020
|
const id = useMemo2(() => `media-audio-${random(src)}-${sequenceContext?.cumulatedFrom}-${sequenceContext?.relativeFrom}-${sequenceContext?.durationInFrames}`, [
|
|
5008
5021
|
src,
|
|
5009
5022
|
sequenceContext?.cumulatedFrom,
|
|
@@ -5111,6 +5124,7 @@ var AudioForRendering = ({
|
|
|
5111
5124
|
id,
|
|
5112
5125
|
audio: environment.isClientSideRendering ? audio.data : Array.from(audio.data),
|
|
5113
5126
|
frame: absoluteFrame,
|
|
5127
|
+
startInVideo,
|
|
5114
5128
|
timestamp: audio.timestamp,
|
|
5115
5129
|
duration: audio.numberOfFrames / getTargetSampleRate() * 1e6,
|
|
5116
5130
|
toneFrequency: toneFrequency ?? 1
|
|
@@ -5145,6 +5159,7 @@ var AudioForRendering = ({
|
|
|
5145
5159
|
playbackRate,
|
|
5146
5160
|
registerRenderAsset,
|
|
5147
5161
|
src,
|
|
5162
|
+
startInVideo,
|
|
5148
5163
|
startsAt,
|
|
5149
5164
|
unregisterRenderAsset,
|
|
5150
5165
|
volumeProp,
|
|
@@ -5550,6 +5565,7 @@ var VideoForPreviewAssertedShowing = ({
|
|
|
5550
5565
|
const initialGlobalPlaybackRate = useRef2(globalPlaybackRate);
|
|
5551
5566
|
const initialPlaybackRate = useRef2(playbackRate);
|
|
5552
5567
|
const initialMuted = useRef2(effectiveMuted);
|
|
5568
|
+
const initialVolume = useRef2(userPreferredVolume);
|
|
5553
5569
|
const initialSequenceDuration = useRef2(videoConfig.durationInFrames);
|
|
5554
5570
|
const initialSequenceOffset = useRef2(sequenceOffset);
|
|
5555
5571
|
const hasDrawnRealFrameRef = useRef2(false);
|
|
@@ -5625,7 +5641,7 @@ var VideoForPreviewAssertedShowing = ({
|
|
|
5625
5641
|
getEffectChainState: (width, height) => effectChainStateRef.current?.get(width, height)
|
|
5626
5642
|
});
|
|
5627
5643
|
mediaPlayerRef.current = player;
|
|
5628
|
-
player.initialize(currentTimeRef.current, initialMuted.current).then((result) => {
|
|
5644
|
+
player.initialize(currentTimeRef.current, initialMuted.current, initialVolume.current).then((result) => {
|
|
5629
5645
|
if (result.type === "disposed") {
|
|
5630
5646
|
return;
|
|
5631
5647
|
}
|
|
@@ -5895,6 +5911,7 @@ var VideoForRendering = ({
|
|
|
5895
5911
|
const { registerRenderAsset, unregisterRenderAsset } = useContext5(Internals23.RenderAssetManager);
|
|
5896
5912
|
const startsAt = Internals23.useMediaStartsAt();
|
|
5897
5913
|
const sequenceContext = useContext5(Internals23.SequenceContext);
|
|
5914
|
+
const startInVideo = sequenceContext ? sequenceContext.cumulatedFrom + sequenceContext.relativeFrom : 0;
|
|
5898
5915
|
const id = useMemo5(() => `media-video-${random2(src)}-${sequenceContext?.cumulatedFrom}-${sequenceContext?.relativeFrom}-${sequenceContext?.durationInFrames}`, [
|
|
5899
5916
|
src,
|
|
5900
5917
|
sequenceContext?.cumulatedFrom,
|
|
@@ -6070,6 +6087,7 @@ var VideoForRendering = ({
|
|
|
6070
6087
|
id,
|
|
6071
6088
|
audio: environment.isClientSideRendering ? audio.data : Array.from(audio.data),
|
|
6072
6089
|
frame: absoluteFrame,
|
|
6090
|
+
startInVideo,
|
|
6073
6091
|
timestamp: audio.timestamp,
|
|
6074
6092
|
duration: audio.numberOfFrames / getTargetSampleRate() * 1e6,
|
|
6075
6093
|
toneFrequency
|
|
@@ -6104,6 +6122,7 @@ var VideoForRendering = ({
|
|
|
6104
6122
|
playbackRate,
|
|
6105
6123
|
registerRenderAsset,
|
|
6106
6124
|
src,
|
|
6125
|
+
startInVideo,
|
|
6107
6126
|
startsAt,
|
|
6108
6127
|
unregisterRenderAsset,
|
|
6109
6128
|
volumeProp,
|
package/dist/media-player.d.ts
CHANGED
|
@@ -78,7 +78,7 @@ export declare class MediaPlayer {
|
|
|
78
78
|
private releaseInput;
|
|
79
79
|
private disposed;
|
|
80
80
|
private isDisposalError;
|
|
81
|
-
initialize(startTimeUnresolved: number, initialMuted: boolean): Promise<MediaPlayerInitResult>;
|
|
81
|
+
initialize(startTimeUnresolved: number, initialMuted: boolean, initialVolume: number): Promise<MediaPlayerInitResult>;
|
|
82
82
|
private getStartTime;
|
|
83
83
|
private getSequenceEndTimestamp;
|
|
84
84
|
private getSequenceDurationInSeconds;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remotion/media",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.517",
|
|
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.55.1",
|
|
26
|
-
"remotion": "4.0.
|
|
26
|
+
"remotion": "4.0.517",
|
|
27
27
|
"zod": "4.4.3"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"react-dom": ">=16.8.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@remotion/eslint-config-internal": "4.0.
|
|
35
|
-
"@remotion/player": "4.0.
|
|
34
|
+
"@remotion/eslint-config-internal": "4.0.517",
|
|
35
|
+
"@remotion/player": "4.0.517",
|
|
36
36
|
"@vitest/browser-webdriverio": "4.0.9",
|
|
37
37
|
"eslint": "9.19.0",
|
|
38
38
|
"react": "19.2.3",
|