@remotion/media 4.0.457 → 4.0.459
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
|
@@ -844,65 +844,90 @@ import { CanvasSink } from "mediabunny";
|
|
|
844
844
|
import { Internals as Internals4 } from "remotion";
|
|
845
845
|
|
|
846
846
|
// src/canvas-ahead-of-time.ts
|
|
847
|
+
var BUFFER_SIZE = 3;
|
|
847
848
|
var canvasesAheadOfTime = (videoSink, startTimestamp) => {
|
|
848
849
|
const iterator = videoSink.canvases(startTimestamp);
|
|
849
|
-
|
|
850
|
-
let
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
850
|
+
const buffer = [];
|
|
851
|
+
let chaining = false;
|
|
852
|
+
let reachedEnd = false;
|
|
853
|
+
let closed = false;
|
|
854
|
+
let inFlight = null;
|
|
855
|
+
const closeFrame = (frame) => {
|
|
856
|
+
frame.close?.();
|
|
857
|
+
};
|
|
858
|
+
const fillNext = () => {
|
|
859
|
+
if (chaining || reachedEnd || closed)
|
|
860
|
+
return;
|
|
861
|
+
if (buffer.length >= BUFFER_SIZE)
|
|
862
|
+
return;
|
|
863
|
+
chaining = true;
|
|
864
|
+
const slot = { promise: iterator.next(), resolved: null };
|
|
865
|
+
buffer.push(slot);
|
|
866
|
+
inFlight = slot.promise.then((result) => {
|
|
867
|
+
slot.resolved = result;
|
|
868
|
+
chaining = false;
|
|
869
|
+
inFlight = null;
|
|
870
|
+
if (result.done) {
|
|
871
|
+
reachedEnd = true;
|
|
872
|
+
return;
|
|
873
|
+
}
|
|
874
|
+
if (closed) {
|
|
875
|
+
closeFrame(result.value);
|
|
876
|
+
return;
|
|
856
877
|
}
|
|
878
|
+
fillNext();
|
|
857
879
|
}, () => {
|
|
858
|
-
|
|
880
|
+
chaining = false;
|
|
881
|
+
inFlight = null;
|
|
859
882
|
});
|
|
860
883
|
};
|
|
861
|
-
|
|
862
|
-
const advance = () => {
|
|
863
|
-
inFlight = iterator.next();
|
|
864
|
-
resolved = null;
|
|
865
|
-
trackResolution();
|
|
866
|
-
};
|
|
884
|
+
fillNext();
|
|
867
885
|
const next = () => {
|
|
868
|
-
|
|
869
|
-
|
|
886
|
+
const slot = buffer.shift();
|
|
887
|
+
fillNext();
|
|
888
|
+
if (!slot) {
|
|
889
|
+
if (reachedEnd || closed) {
|
|
870
890
|
return { type: "ready", frame: null };
|
|
871
891
|
}
|
|
872
|
-
const
|
|
873
|
-
|
|
874
|
-
|
|
892
|
+
const chain = inFlight;
|
|
893
|
+
return {
|
|
894
|
+
type: "pending",
|
|
895
|
+
wait: async () => {
|
|
896
|
+
await chain;
|
|
897
|
+
const next2 = buffer.shift();
|
|
898
|
+
fillNext();
|
|
899
|
+
if (!next2)
|
|
900
|
+
return null;
|
|
901
|
+
if (next2.resolved) {
|
|
902
|
+
return next2.resolved.done ? null : next2.resolved.value;
|
|
903
|
+
}
|
|
904
|
+
const result = await next2.promise;
|
|
905
|
+
return result.done ? null : result.value;
|
|
906
|
+
}
|
|
907
|
+
};
|
|
908
|
+
}
|
|
909
|
+
if (slot.resolved) {
|
|
910
|
+
if (slot.resolved.done) {
|
|
911
|
+
return { type: "ready", frame: null };
|
|
912
|
+
}
|
|
913
|
+
return { type: "ready", frame: slot.resolved.value };
|
|
875
914
|
}
|
|
876
|
-
const captured = inFlight;
|
|
877
915
|
return {
|
|
878
916
|
type: "pending",
|
|
879
917
|
wait: async () => {
|
|
880
|
-
const result = await
|
|
881
|
-
if (captured === inFlight && !result.done) {
|
|
882
|
-
advance();
|
|
883
|
-
}
|
|
918
|
+
const result = await slot.promise;
|
|
884
919
|
return result.done ? null : result.value;
|
|
885
920
|
}
|
|
886
921
|
};
|
|
887
922
|
};
|
|
888
|
-
const closeFrame = (frame) => {
|
|
889
|
-
frame.close?.();
|
|
890
|
-
};
|
|
891
923
|
const closeIterator = async () => {
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
924
|
+
closed = true;
|
|
925
|
+
for (const slot of buffer) {
|
|
926
|
+
if (slot.resolved && !slot.resolved.done) {
|
|
927
|
+
closeFrame(slot.resolved.value);
|
|
895
928
|
}
|
|
896
|
-
} else {
|
|
897
|
-
const captured = inFlight;
|
|
898
|
-
captured.then((result) => {
|
|
899
|
-
if (!result.done) {
|
|
900
|
-
closeFrame(result.value);
|
|
901
|
-
}
|
|
902
|
-
}, () => {
|
|
903
|
-
return;
|
|
904
|
-
});
|
|
905
929
|
}
|
|
930
|
+
buffer.length = 0;
|
|
906
931
|
await iterator.return();
|
|
907
932
|
};
|
|
908
933
|
return { next, closeIterator };
|
|
@@ -1946,8 +1971,7 @@ var AudioForPreviewAssertedShowing = ({
|
|
|
1946
1971
|
const [mediaPlayerReady, setMediaPlayerReady] = useState(false);
|
|
1947
1972
|
const [shouldFallbackToNativeAudio, setShouldFallbackToNativeAudio] = useState(false);
|
|
1948
1973
|
const [playing] = Timeline.usePlayingState();
|
|
1949
|
-
const
|
|
1950
|
-
const globalPlaybackRate = timelineContext.playbackRate;
|
|
1974
|
+
const { playbackRate: globalPlaybackRate } = Internals7.usePlaybackRate();
|
|
1951
1975
|
const sharedAudioContext = useContext2(SharedAudioContext);
|
|
1952
1976
|
const buffer = useBufferState();
|
|
1953
1977
|
const [mediaMuted] = useMediaMutedState();
|
|
@@ -4553,8 +4577,7 @@ var VideoForPreviewAssertedShowing = ({
|
|
|
4553
4577
|
const [mediaPlayerReady, setMediaPlayerReady] = useState4(false);
|
|
4554
4578
|
const [shouldFallbackToNativeVideo, setShouldFallbackToNativeVideo] = useState4(false);
|
|
4555
4579
|
const [playing] = Timeline2.usePlayingState();
|
|
4556
|
-
const
|
|
4557
|
-
const globalPlaybackRate = timelineContext.playbackRate;
|
|
4580
|
+
const { playbackRate: globalPlaybackRate } = Internals18.usePlaybackRate();
|
|
4558
4581
|
const sharedAudioContext = useContext4(SharedAudioContext2);
|
|
4559
4582
|
const buffer = useBufferState2();
|
|
4560
4583
|
const [mediaMuted] = useMediaMutedState2();
|
|
@@ -5219,34 +5242,7 @@ var videoSchema = {
|
|
|
5219
5242
|
description: "Playback Rate"
|
|
5220
5243
|
},
|
|
5221
5244
|
loop: { type: "boolean", default: false, description: "Loop" },
|
|
5222
|
-
|
|
5223
|
-
type: "translate",
|
|
5224
|
-
step: 1,
|
|
5225
|
-
default: "0px 0px",
|
|
5226
|
-
description: "Position"
|
|
5227
|
-
},
|
|
5228
|
-
"style.scale": {
|
|
5229
|
-
type: "number",
|
|
5230
|
-
min: 0.05,
|
|
5231
|
-
max: 100,
|
|
5232
|
-
step: 0.01,
|
|
5233
|
-
default: 1,
|
|
5234
|
-
description: "Scale"
|
|
5235
|
-
},
|
|
5236
|
-
"style.rotate": {
|
|
5237
|
-
type: "rotation",
|
|
5238
|
-
step: 1,
|
|
5239
|
-
default: "0deg",
|
|
5240
|
-
description: "Rotation"
|
|
5241
|
-
},
|
|
5242
|
-
"style.opacity": {
|
|
5243
|
-
type: "number",
|
|
5244
|
-
min: 0,
|
|
5245
|
-
max: 1,
|
|
5246
|
-
step: 0.01,
|
|
5247
|
-
default: 1,
|
|
5248
|
-
description: "Opacity"
|
|
5249
|
-
}
|
|
5245
|
+
...Internals20.sequenceStyleSchema
|
|
5250
5246
|
};
|
|
5251
5247
|
var InnerVideo = ({
|
|
5252
5248
|
src,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { EffectDefinitionAndStack, LoopDisplay, SequenceControls } from 'remotion';
|
|
2
2
|
import { type VolumeProp } from 'remotion';
|
|
3
3
|
export declare const useMediaInTimeline: ({ volume, mediaVolume, src, mediaType, playbackRate, displayName, stack, showInTimeline, premountDisplay, postmountDisplay, loopDisplay, trimBefore, trimAfter, controls, _experimentalEffects, }: {
|
|
4
4
|
volume: VolumeProp | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remotion/media",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.459",
|
|
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.42.0",
|
|
26
|
-
"remotion": "4.0.
|
|
26
|
+
"remotion": "4.0.459",
|
|
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.459",
|
|
35
35
|
"@vitest/browser-webdriverio": "4.0.9",
|
|
36
36
|
"eslint": "9.19.0",
|
|
37
37
|
"react": "19.2.3",
|
|
@@ -1,14 +0,0 @@
|
|
|
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,14 +0,0 @@
|
|
|
1
|
-
export type ObjectFitValue = 'fill' | 'contain' | 'cover' | 'none' | 'scale-down';
|
|
2
|
-
/**
|
|
3
|
-
* Draws a source image onto a canvas context with the specified object-fit behavior.
|
|
4
|
-
* This implements object-fit at the canvas drawing level, which is more reliable
|
|
5
|
-
* than CSS object-fit on canvas elements.
|
|
6
|
-
*/
|
|
7
|
-
export declare const drawWithObjectFit: (ctx: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D, source: CanvasImageSource, options: {
|
|
8
|
-
sourceWidth: number;
|
|
9
|
-
sourceHeight: number;
|
|
10
|
-
destWidth: number;
|
|
11
|
-
destHeight: number;
|
|
12
|
-
fit: ObjectFitValue;
|
|
13
|
-
}) => void;
|
|
14
|
-
export declare const parseObjectFit: (value: string | undefined) => ObjectFitValue | null;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export declare const ALLOWED_GLOBAL_TIME_ANCHOR_SHIFT = 0.1;
|
|
2
|
-
export declare const setGlobalTimeAnchor: ({ audioContext, audioSyncAnchor, absoluteTimeInSeconds, globalPlaybackRate, debugAudioScheduling, logLevel, }: {
|
|
3
|
-
audioContext: AudioContext;
|
|
4
|
-
audioSyncAnchor: {
|
|
5
|
-
value: number;
|
|
6
|
-
};
|
|
7
|
-
absoluteTimeInSeconds: number;
|
|
8
|
-
globalPlaybackRate: number;
|
|
9
|
-
debugAudioScheduling: boolean;
|
|
10
|
-
logLevel: "error" | "info" | "trace" | "verbose" | "warn";
|
|
11
|
-
}) => void;
|