@remotion/media 4.0.452 → 4.0.453
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/canvas-ahead-of-time.d.ts +13 -0
- package/dist/debug-overlay/preview-overlay.d.ts +2 -2
- package/dist/esm/index.mjs +110 -72
- package/dist/media-player.d.ts +3 -1
- package/dist/prewarm-iterator-for-looping.d.ts +5 -2
- package/dist/video/video-preview-iterator.d.ts +6 -3
- package/dist/video-iterator-manager.d.ts +2 -2
- package/package.json +3 -3
- package/dist/calculate-playbacktime.d.ts +0 -5
- package/dist/set-global-time-anchor.d.ts +0 -11
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { CanvasSink, WrappedCanvas } from 'mediabunny';
|
|
2
|
+
export type CanvasAheadOfTimeNext = {
|
|
3
|
+
type: 'ready';
|
|
4
|
+
frame: WrappedCanvas | null;
|
|
5
|
+
} | {
|
|
6
|
+
type: 'pending';
|
|
7
|
+
wait: () => Promise<WrappedCanvas | null>;
|
|
8
|
+
};
|
|
9
|
+
export declare const canvasesAheadOfTime: (videoSink: CanvasSink, startTimestamp?: number | undefined) => {
|
|
10
|
+
next: () => CanvasAheadOfTimeNext;
|
|
11
|
+
closeIterator: () => Promise<void>;
|
|
12
|
+
};
|
|
13
|
+
export type CanvasAheadOfTimeIterator = ReturnType<typeof canvasesAheadOfTime>;
|
|
@@ -78,13 +78,13 @@ export declare const drawPreviewOverlay: ({ context, audioTime, audioContextStat
|
|
|
78
78
|
destroy: () => void;
|
|
79
79
|
initialFrame: import("mediabunny").WrappedCanvas | null;
|
|
80
80
|
isDestroyed: () => boolean;
|
|
81
|
-
tryToSatisfySeek: (time: number) =>
|
|
81
|
+
tryToSatisfySeek: (time: number) => {
|
|
82
82
|
type: "not-satisfied";
|
|
83
83
|
reason: string;
|
|
84
84
|
} | {
|
|
85
85
|
type: "satisfied";
|
|
86
86
|
frame: import("mediabunny").WrappedCanvas;
|
|
87
|
-
}
|
|
87
|
+
};
|
|
88
88
|
} | null;
|
|
89
89
|
drawFrame: (frame: import("mediabunny").WrappedCanvas) => void;
|
|
90
90
|
getFramesRendered: () => number;
|
package/dist/esm/index.mjs
CHANGED
|
@@ -45,7 +45,7 @@ import {
|
|
|
45
45
|
Internals as Internals8,
|
|
46
46
|
Audio as RemotionAudio,
|
|
47
47
|
useBufferState,
|
|
48
|
-
useCurrentFrame
|
|
48
|
+
useCurrentFrame,
|
|
49
49
|
useVideoConfig as useVideoConfig2
|
|
50
50
|
} from "remotion";
|
|
51
51
|
|
|
@@ -788,12 +788,77 @@ var makeNonceManager = () => {
|
|
|
788
788
|
import { CanvasSink } from "mediabunny";
|
|
789
789
|
import { Internals as Internals3 } from "remotion";
|
|
790
790
|
|
|
791
|
+
// src/canvas-ahead-of-time.ts
|
|
792
|
+
var canvasesAheadOfTime = (videoSink, startTimestamp) => {
|
|
793
|
+
const iterator = videoSink.canvases(startTimestamp);
|
|
794
|
+
let inFlight = iterator.next();
|
|
795
|
+
let resolved = null;
|
|
796
|
+
const trackResolution = () => {
|
|
797
|
+
const captured = inFlight;
|
|
798
|
+
captured.then((result) => {
|
|
799
|
+
if (captured === inFlight) {
|
|
800
|
+
resolved = result;
|
|
801
|
+
}
|
|
802
|
+
}, () => {
|
|
803
|
+
return;
|
|
804
|
+
});
|
|
805
|
+
};
|
|
806
|
+
trackResolution();
|
|
807
|
+
const advance = () => {
|
|
808
|
+
inFlight = iterator.next();
|
|
809
|
+
resolved = null;
|
|
810
|
+
trackResolution();
|
|
811
|
+
};
|
|
812
|
+
const next = () => {
|
|
813
|
+
if (resolved) {
|
|
814
|
+
if (resolved.done) {
|
|
815
|
+
return { type: "ready", frame: null };
|
|
816
|
+
}
|
|
817
|
+
const frame = resolved.value;
|
|
818
|
+
advance();
|
|
819
|
+
return { type: "ready", frame };
|
|
820
|
+
}
|
|
821
|
+
const captured = inFlight;
|
|
822
|
+
return {
|
|
823
|
+
type: "pending",
|
|
824
|
+
wait: async () => {
|
|
825
|
+
const result = await captured;
|
|
826
|
+
if (captured === inFlight && !result.done) {
|
|
827
|
+
advance();
|
|
828
|
+
}
|
|
829
|
+
return result.done ? null : result.value;
|
|
830
|
+
}
|
|
831
|
+
};
|
|
832
|
+
};
|
|
833
|
+
const closeFrame = (frame) => {
|
|
834
|
+
frame.close?.();
|
|
835
|
+
};
|
|
836
|
+
const closeIterator = async () => {
|
|
837
|
+
if (resolved) {
|
|
838
|
+
if (!resolved.done) {
|
|
839
|
+
closeFrame(resolved.value);
|
|
840
|
+
}
|
|
841
|
+
} else {
|
|
842
|
+
const captured = inFlight;
|
|
843
|
+
captured.then((result) => {
|
|
844
|
+
if (!result.done) {
|
|
845
|
+
closeFrame(result.value);
|
|
846
|
+
}
|
|
847
|
+
}, () => {
|
|
848
|
+
return;
|
|
849
|
+
});
|
|
850
|
+
}
|
|
851
|
+
await iterator.return();
|
|
852
|
+
};
|
|
853
|
+
return { next, closeIterator };
|
|
854
|
+
};
|
|
855
|
+
|
|
791
856
|
// src/prewarm-iterator-for-looping.ts
|
|
792
857
|
var makePrewarmedVideoIteratorCache = (videoSink) => {
|
|
793
858
|
const prewarmedVideoIterators = new Map;
|
|
794
859
|
const prewarmIteratorForLooping = ({ timeToSeek }) => {
|
|
795
860
|
if (!prewarmedVideoIterators.has(timeToSeek)) {
|
|
796
|
-
prewarmedVideoIterators.set(timeToSeek, videoSink
|
|
861
|
+
prewarmedVideoIterators.set(timeToSeek, canvasesAheadOfTime(videoSink, timeToSeek));
|
|
797
862
|
}
|
|
798
863
|
};
|
|
799
864
|
const makeIteratorOrUsePrewarmed = (timeToSeek) => {
|
|
@@ -802,12 +867,11 @@ var makePrewarmedVideoIteratorCache = (videoSink) => {
|
|
|
802
867
|
prewarmedVideoIterators.delete(timeToSeek);
|
|
803
868
|
return prewarmedIterator;
|
|
804
869
|
}
|
|
805
|
-
|
|
806
|
-
return iterator;
|
|
870
|
+
return canvasesAheadOfTime(videoSink, timeToSeek);
|
|
807
871
|
};
|
|
808
872
|
const destroy = () => {
|
|
809
873
|
for (const iterator of prewarmedVideoIterators.values()) {
|
|
810
|
-
iterator.
|
|
874
|
+
iterator.closeIterator();
|
|
811
875
|
}
|
|
812
876
|
prewarmedVideoIterators.clear();
|
|
813
877
|
};
|
|
@@ -828,48 +892,43 @@ var createVideoIterator = async (timeToSeek, cache) => {
|
|
|
828
892
|
let destroyed = false;
|
|
829
893
|
const iterator = cache.makeIteratorOrUsePrewarmed(timeToSeek);
|
|
830
894
|
let iteratorEnded = false;
|
|
831
|
-
const
|
|
895
|
+
const firstAwait = iterator.next();
|
|
896
|
+
const initialFrame = firstAwait && firstAwait.type === "ready" ? firstAwait.frame : await firstAwait.wait();
|
|
832
897
|
let lastReturnedFrame = initialFrame;
|
|
833
|
-
const getNextOrNullIfNotAvailable =
|
|
898
|
+
const getNextOrNullIfNotAvailable = () => {
|
|
834
899
|
const next = iterator.next();
|
|
835
|
-
|
|
836
|
-
next,
|
|
837
|
-
new Promise((resolve) => {
|
|
838
|
-
Promise.resolve().then(() => resolve());
|
|
839
|
-
})
|
|
840
|
-
]);
|
|
841
|
-
if (!result) {
|
|
900
|
+
if (next.type === "pending") {
|
|
842
901
|
return {
|
|
843
902
|
type: "need-to-wait-for-it",
|
|
844
903
|
waitPromise: async () => {
|
|
845
|
-
const res = await next;
|
|
846
|
-
if (res
|
|
847
|
-
lastReturnedFrame = res
|
|
904
|
+
const res = await next.wait();
|
|
905
|
+
if (res) {
|
|
906
|
+
lastReturnedFrame = res;
|
|
848
907
|
} else {
|
|
849
908
|
iteratorEnded = true;
|
|
850
909
|
}
|
|
851
|
-
return res
|
|
910
|
+
return res;
|
|
852
911
|
}
|
|
853
912
|
};
|
|
854
913
|
}
|
|
855
|
-
if (
|
|
856
|
-
lastReturnedFrame =
|
|
914
|
+
if (next.frame) {
|
|
915
|
+
lastReturnedFrame = next.frame;
|
|
857
916
|
} else {
|
|
858
917
|
iteratorEnded = true;
|
|
859
918
|
}
|
|
860
919
|
return {
|
|
861
920
|
type: "got-frame-or-end",
|
|
862
|
-
frame:
|
|
921
|
+
frame: next.frame ?? null
|
|
863
922
|
};
|
|
864
923
|
};
|
|
865
924
|
const destroy = () => {
|
|
866
925
|
destroyed = true;
|
|
867
926
|
lastReturnedFrame = null;
|
|
868
|
-
iterator.
|
|
927
|
+
iterator.closeIterator().catch(() => {
|
|
869
928
|
return;
|
|
870
929
|
});
|
|
871
930
|
};
|
|
872
|
-
const tryToSatisfySeek =
|
|
931
|
+
const tryToSatisfySeek = (time) => {
|
|
873
932
|
if (lastReturnedFrame) {
|
|
874
933
|
const frameTimestamp = roundTo4Digits(lastReturnedFrame.timestamp);
|
|
875
934
|
if (roundTo4Digits(time) < frameTimestamp) {
|
|
@@ -908,7 +967,7 @@ var createVideoIterator = async (timeToSeek, cache) => {
|
|
|
908
967
|
};
|
|
909
968
|
}
|
|
910
969
|
while (true) {
|
|
911
|
-
const frame =
|
|
970
|
+
const frame = getNextOrNullIfNotAvailable();
|
|
912
971
|
if (frame.type === "need-to-wait-for-it") {
|
|
913
972
|
return {
|
|
914
973
|
type: "not-satisfied",
|
|
@@ -1034,7 +1093,7 @@ var videoIteratorManager = ({
|
|
|
1034
1093
|
});
|
|
1035
1094
|
}
|
|
1036
1095
|
}
|
|
1037
|
-
const videoSatisfyResult =
|
|
1096
|
+
const videoSatisfyResult = videoFrameIterator.tryToSatisfySeek(newTime);
|
|
1038
1097
|
if (videoSatisfyResult.type === "satisfied") {
|
|
1039
1098
|
drawFrame(videoSatisfyResult.frame);
|
|
1040
1099
|
return;
|
|
@@ -1068,6 +1127,7 @@ var videoIteratorManager = ({
|
|
|
1068
1127
|
|
|
1069
1128
|
// src/media-player.ts
|
|
1070
1129
|
class MediaPlayer {
|
|
1130
|
+
tagType;
|
|
1071
1131
|
canvas;
|
|
1072
1132
|
context;
|
|
1073
1133
|
src;
|
|
@@ -1114,7 +1174,8 @@ class MediaPlayer {
|
|
|
1114
1174
|
onVideoFrameCallback,
|
|
1115
1175
|
playing,
|
|
1116
1176
|
sequenceOffset,
|
|
1117
|
-
credentials
|
|
1177
|
+
credentials,
|
|
1178
|
+
tagType
|
|
1118
1179
|
}) {
|
|
1119
1180
|
this.canvas = canvas ?? null;
|
|
1120
1181
|
this.src = src;
|
|
@@ -1142,6 +1203,7 @@ class MediaPlayer {
|
|
|
1142
1203
|
} : undefined),
|
|
1143
1204
|
formats: ALL_FORMATS
|
|
1144
1205
|
});
|
|
1206
|
+
this.tagType = tagType;
|
|
1145
1207
|
if (canvas) {
|
|
1146
1208
|
const context = canvas.getContext("2d", {
|
|
1147
1209
|
alpha: true,
|
|
@@ -1221,7 +1283,7 @@ class MediaPlayer {
|
|
|
1221
1283
|
if (!videoTrack && !audioTrack) {
|
|
1222
1284
|
return { type: "no-tracks" };
|
|
1223
1285
|
}
|
|
1224
|
-
if (videoTrack) {
|
|
1286
|
+
if (videoTrack && this.tagType === "video") {
|
|
1225
1287
|
const canDecode = await videoTrack.canDecode();
|
|
1226
1288
|
if (!canDecode) {
|
|
1227
1289
|
return { type: "cannot-decode" };
|
|
@@ -1778,8 +1840,8 @@ var useCommonEffects = ({
|
|
|
1778
1840
|
};
|
|
1779
1841
|
|
|
1780
1842
|
// src/use-media-in-timeline.ts
|
|
1781
|
-
import { useContext as useContext2,
|
|
1782
|
-
import { Internals as Internals7
|
|
1843
|
+
import { useContext as useContext2, useEffect, useState } from "react";
|
|
1844
|
+
import { Internals as Internals7 } from "remotion";
|
|
1783
1845
|
var useMediaInTimeline = ({
|
|
1784
1846
|
volume,
|
|
1785
1847
|
mediaVolume,
|
|
@@ -1799,9 +1861,7 @@ var useMediaInTimeline = ({
|
|
|
1799
1861
|
const parentSequence = useContext2(Internals7.SequenceContext);
|
|
1800
1862
|
const startsAt = Internals7.useMediaStartsAt();
|
|
1801
1863
|
const { registerSequence, unregisterSequence } = useContext2(Internals7.SequenceManager);
|
|
1802
|
-
const [sequenceId] = useState(() => String(Math.random()));
|
|
1803
1864
|
const [mediaId] = useState(() => String(Math.random()));
|
|
1804
|
-
const frame = useCurrentFrame();
|
|
1805
1865
|
const {
|
|
1806
1866
|
volumes,
|
|
1807
1867
|
duration,
|
|
@@ -1830,32 +1890,13 @@ var useMediaInTimeline = ({
|
|
|
1830
1890
|
if (!showInTimeline) {
|
|
1831
1891
|
return;
|
|
1832
1892
|
}
|
|
1833
|
-
const loopIteration = loopDisplay ? Math.floor(frame / loopDisplay.durationInFrames) : 0;
|
|
1834
|
-
if (loopDisplay) {
|
|
1835
|
-
registerSequence({
|
|
1836
|
-
type: "sequence",
|
|
1837
|
-
premountDisplay,
|
|
1838
|
-
postmountDisplay,
|
|
1839
|
-
parent: parentSequence?.id ?? null,
|
|
1840
|
-
displayName: finalDisplayName,
|
|
1841
|
-
rootId,
|
|
1842
|
-
showInTimeline: true,
|
|
1843
|
-
nonce: nonce.get(),
|
|
1844
|
-
loopDisplay,
|
|
1845
|
-
stack,
|
|
1846
|
-
from: 0,
|
|
1847
|
-
duration,
|
|
1848
|
-
id: sequenceId,
|
|
1849
|
-
controls: null
|
|
1850
|
-
});
|
|
1851
|
-
}
|
|
1852
1893
|
registerSequence({
|
|
1853
1894
|
type: mediaType,
|
|
1854
1895
|
src,
|
|
1855
1896
|
id: mediaId,
|
|
1856
|
-
duration
|
|
1857
|
-
from:
|
|
1858
|
-
parent:
|
|
1897
|
+
duration,
|
|
1898
|
+
from: 0,
|
|
1899
|
+
parent: parentSequence?.id ?? null,
|
|
1859
1900
|
displayName: finalDisplayName,
|
|
1860
1901
|
rootId,
|
|
1861
1902
|
volume: volumes,
|
|
@@ -1863,17 +1904,14 @@ var useMediaInTimeline = ({
|
|
|
1863
1904
|
nonce: nonce.get(),
|
|
1864
1905
|
startMediaFrom: 0 - startsAt + (trimBefore ?? 0),
|
|
1865
1906
|
doesVolumeChange,
|
|
1866
|
-
loopDisplay
|
|
1907
|
+
loopDisplay,
|
|
1867
1908
|
playbackRate,
|
|
1868
1909
|
stack,
|
|
1869
|
-
premountDisplay
|
|
1870
|
-
postmountDisplay
|
|
1910
|
+
premountDisplay,
|
|
1911
|
+
postmountDisplay,
|
|
1871
1912
|
controls: controls ?? null
|
|
1872
1913
|
});
|
|
1873
1914
|
return () => {
|
|
1874
|
-
if (loopDisplay) {
|
|
1875
|
-
unregisterSequence(sequenceId);
|
|
1876
|
-
}
|
|
1877
1915
|
unregisterSequence(mediaId);
|
|
1878
1916
|
};
|
|
1879
1917
|
}, [
|
|
@@ -1892,14 +1930,12 @@ var useMediaInTimeline = ({
|
|
|
1892
1930
|
premountDisplay,
|
|
1893
1931
|
registerSequence,
|
|
1894
1932
|
rootId,
|
|
1895
|
-
sequenceId,
|
|
1896
1933
|
showInTimeline,
|
|
1897
1934
|
src,
|
|
1898
1935
|
stack,
|
|
1899
1936
|
startsAt,
|
|
1900
1937
|
unregisterSequence,
|
|
1901
1938
|
volumes,
|
|
1902
|
-
frame,
|
|
1903
1939
|
trimBefore
|
|
1904
1940
|
]);
|
|
1905
1941
|
return {
|
|
@@ -1943,7 +1979,7 @@ var AudioForPreviewAssertedShowing = ({
|
|
|
1943
1979
|
controls
|
|
1944
1980
|
}) => {
|
|
1945
1981
|
const videoConfig = useUnsafeVideoConfig();
|
|
1946
|
-
const frame =
|
|
1982
|
+
const frame = useCurrentFrame();
|
|
1947
1983
|
const mediaPlayerRef = useRef(null);
|
|
1948
1984
|
const initialTrimBeforeRef = useRef(trimBefore);
|
|
1949
1985
|
const initialTrimAfterRef = useRef(trimAfter);
|
|
@@ -2080,7 +2116,8 @@ var AudioForPreviewAssertedShowing = ({
|
|
|
2080
2116
|
onVideoFrameCallback: null,
|
|
2081
2117
|
playing: initialPlaying.current,
|
|
2082
2118
|
sequenceOffset: initialSequenceOffset.current,
|
|
2083
|
-
credentials
|
|
2119
|
+
credentials,
|
|
2120
|
+
tagType: "audio"
|
|
2084
2121
|
});
|
|
2085
2122
|
mediaPlayerRef.current = player;
|
|
2086
2123
|
player.initialize(currentTimeRef.current, initialMuted.current).then((result) => {
|
|
@@ -2218,7 +2255,7 @@ var AudioForPreview = ({
|
|
|
2218
2255
|
}) => {
|
|
2219
2256
|
const preloadedSrc = usePreload(src);
|
|
2220
2257
|
const defaultLogLevel = Internals8.useLogLevel();
|
|
2221
|
-
const frame =
|
|
2258
|
+
const frame = useCurrentFrame();
|
|
2222
2259
|
const videoConfig = useVideoConfig2();
|
|
2223
2260
|
const currentTime = frame / videoConfig.fps;
|
|
2224
2261
|
const showShow = useMemo2(() => {
|
|
@@ -2275,7 +2312,7 @@ import {
|
|
|
2275
2312
|
Html5Audio,
|
|
2276
2313
|
Internals as Internals16,
|
|
2277
2314
|
random,
|
|
2278
|
-
useCurrentFrame as
|
|
2315
|
+
useCurrentFrame as useCurrentFrame2,
|
|
2279
2316
|
useDelayRender,
|
|
2280
2317
|
useRemotionEnvironment
|
|
2281
2318
|
} from "remotion";
|
|
@@ -4157,7 +4194,7 @@ var AudioForRendering = ({
|
|
|
4157
4194
|
}) => {
|
|
4158
4195
|
const defaultLogLevel = Internals16.useLogLevel();
|
|
4159
4196
|
const logLevel = overriddenLogLevel ?? defaultLogLevel;
|
|
4160
|
-
const frame =
|
|
4197
|
+
const frame = useCurrentFrame2();
|
|
4161
4198
|
const absoluteFrame = Internals16.useTimelinePosition();
|
|
4162
4199
|
const videoConfig = Internals16.useUnsafeVideoConfig();
|
|
4163
4200
|
const { registerRenderAsset, unregisterRenderAsset } = useContext4(Internals16.RenderAssetManager);
|
|
@@ -4408,7 +4445,7 @@ import {
|
|
|
4408
4445
|
Html5Video,
|
|
4409
4446
|
Internals as Internals19,
|
|
4410
4447
|
useBufferState as useBufferState2,
|
|
4411
|
-
useCurrentFrame as
|
|
4448
|
+
useCurrentFrame as useCurrentFrame3,
|
|
4412
4449
|
useVideoConfig as useVideoConfig3
|
|
4413
4450
|
} from "remotion";
|
|
4414
4451
|
|
|
@@ -4500,7 +4537,7 @@ var VideoForPreviewAssertedShowing = ({
|
|
|
4500
4537
|
const src = usePreload2(unpreloadedSrc);
|
|
4501
4538
|
const canvasRef = useRef2(null);
|
|
4502
4539
|
const videoConfig = useUnsafeVideoConfig2();
|
|
4503
|
-
const frame =
|
|
4540
|
+
const frame = useCurrentFrame3();
|
|
4504
4541
|
const mediaPlayerRef = useRef2(null);
|
|
4505
4542
|
const initialTrimBeforeRef = useRef2(trimBefore);
|
|
4506
4543
|
const initialTrimAfterRef = useRef2(trimAfter);
|
|
@@ -4652,7 +4689,8 @@ var VideoForPreviewAssertedShowing = ({
|
|
|
4652
4689
|
onVideoFrameCallback: initialOnVideoFrameRef.current ?? null,
|
|
4653
4690
|
playing: initialPlaying.current,
|
|
4654
4691
|
sequenceOffset: initialSequenceOffset.current,
|
|
4655
|
-
credentials
|
|
4692
|
+
credentials,
|
|
4693
|
+
tagType: "video"
|
|
4656
4694
|
});
|
|
4657
4695
|
mediaPlayerRef.current = player;
|
|
4658
4696
|
player.initialize(currentTimeRef.current, initialMuted.current).then((result) => {
|
|
@@ -4821,7 +4859,7 @@ var VideoForPreviewAssertedShowing = ({
|
|
|
4821
4859
|
});
|
|
4822
4860
|
};
|
|
4823
4861
|
var VideoForPreview = (props) => {
|
|
4824
|
-
const frame =
|
|
4862
|
+
const frame = useCurrentFrame3();
|
|
4825
4863
|
const videoConfig = useVideoConfig3();
|
|
4826
4864
|
const currentTime = frame / videoConfig.fps;
|
|
4827
4865
|
const showShow = useMemo4(() => {
|
|
@@ -4866,7 +4904,7 @@ import {
|
|
|
4866
4904
|
Internals as Internals20,
|
|
4867
4905
|
Loop,
|
|
4868
4906
|
random as random2,
|
|
4869
|
-
useCurrentFrame as
|
|
4907
|
+
useCurrentFrame as useCurrentFrame4,
|
|
4870
4908
|
useDelayRender as useDelayRender2,
|
|
4871
4909
|
useRemotionEnvironment as useRemotionEnvironment3,
|
|
4872
4910
|
useVideoConfig as useVideoConfig4
|
|
@@ -4901,7 +4939,7 @@ var VideoForRendering = ({
|
|
|
4901
4939
|
if (!src) {
|
|
4902
4940
|
throw new TypeError("No `src` was passed to <Video>.");
|
|
4903
4941
|
}
|
|
4904
|
-
const frame =
|
|
4942
|
+
const frame = useCurrentFrame4();
|
|
4905
4943
|
const absoluteFrame = Internals20.useTimelinePosition();
|
|
4906
4944
|
const { fps } = useVideoConfig4();
|
|
4907
4945
|
const { registerRenderAsset, unregisterRenderAsset } = useContext6(Internals20.RenderAssetManager);
|
package/dist/media-player.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ export type MediaPlayerInitResult = {
|
|
|
17
17
|
type: 'disposed';
|
|
18
18
|
};
|
|
19
19
|
export declare class MediaPlayer {
|
|
20
|
+
private tagType;
|
|
20
21
|
private canvas;
|
|
21
22
|
private context;
|
|
22
23
|
private src;
|
|
@@ -43,7 +44,7 @@ export declare class MediaPlayer {
|
|
|
43
44
|
private isPremounting;
|
|
44
45
|
private isPostmounting;
|
|
45
46
|
private seekPromiseChain;
|
|
46
|
-
constructor({ canvas, src, logLevel, sharedAudioContext, loop, trimBefore, trimAfter, playbackRate, globalPlaybackRate, audioStreamIndex, fps, debugOverlay, bufferState, isPremounting, isPostmounting, durationInFrames, onVideoFrameCallback, playing, sequenceOffset, credentials }: {
|
|
47
|
+
constructor({ canvas, src, logLevel, sharedAudioContext, loop, trimBefore, trimAfter, playbackRate, globalPlaybackRate, audioStreamIndex, fps, debugOverlay, bufferState, isPremounting, isPostmounting, durationInFrames, onVideoFrameCallback, playing, sequenceOffset, credentials, tagType }: {
|
|
47
48
|
canvas: HTMLCanvasElement | OffscreenCanvas | null;
|
|
48
49
|
src: string;
|
|
49
50
|
logLevel: LogLevel;
|
|
@@ -64,6 +65,7 @@ export declare class MediaPlayer {
|
|
|
64
65
|
playing: boolean;
|
|
65
66
|
sequenceOffset: number;
|
|
66
67
|
credentials: RequestCredentials | undefined;
|
|
68
|
+
tagType: 'audio' | 'video';
|
|
67
69
|
});
|
|
68
70
|
private input;
|
|
69
71
|
private isDisposalError;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import type { CanvasSink
|
|
1
|
+
import type { CanvasSink } from 'mediabunny';
|
|
2
2
|
export declare const makePrewarmedVideoIteratorCache: (videoSink: CanvasSink) => {
|
|
3
3
|
prewarmIteratorForLooping: ({ timeToSeek }: {
|
|
4
4
|
timeToSeek: number;
|
|
5
5
|
}) => void;
|
|
6
|
-
makeIteratorOrUsePrewarmed: (timeToSeek: number) =>
|
|
6
|
+
makeIteratorOrUsePrewarmed: (timeToSeek: number) => {
|
|
7
|
+
next: () => import("./canvas-ahead-of-time").CanvasAheadOfTimeNext;
|
|
8
|
+
closeIterator: () => Promise<void>;
|
|
9
|
+
};
|
|
7
10
|
destroy: () => void;
|
|
8
11
|
};
|
|
9
12
|
export type PrewarmedVideoIteratorCache = ReturnType<typeof makePrewarmedVideoIteratorCache>;
|
|
@@ -3,18 +3,21 @@ export declare const createVideoIterator: (timeToSeek: number, cache: {
|
|
|
3
3
|
prewarmIteratorForLooping: ({ timeToSeek }: {
|
|
4
4
|
timeToSeek: number;
|
|
5
5
|
}) => void;
|
|
6
|
-
makeIteratorOrUsePrewarmed: (timeToSeek: number) =>
|
|
6
|
+
makeIteratorOrUsePrewarmed: (timeToSeek: number) => {
|
|
7
|
+
next: () => import("../canvas-ahead-of-time").CanvasAheadOfTimeNext;
|
|
8
|
+
closeIterator: () => Promise<void>;
|
|
9
|
+
};
|
|
7
10
|
destroy: () => void;
|
|
8
11
|
}) => Promise<{
|
|
9
12
|
destroy: () => void;
|
|
10
13
|
initialFrame: WrappedCanvas | null;
|
|
11
14
|
isDestroyed: () => boolean;
|
|
12
|
-
tryToSatisfySeek: (time: number) =>
|
|
15
|
+
tryToSatisfySeek: (time: number) => {
|
|
13
16
|
type: "not-satisfied";
|
|
14
17
|
reason: string;
|
|
15
18
|
} | {
|
|
16
19
|
type: "satisfied";
|
|
17
20
|
frame: WrappedCanvas;
|
|
18
|
-
}
|
|
21
|
+
};
|
|
19
22
|
}>;
|
|
20
23
|
export type VideoIterator = Awaited<ReturnType<typeof createVideoIterator>>;
|
|
@@ -24,13 +24,13 @@ export declare const videoIteratorManager: ({ delayPlaybackHandleIfNotPremountin
|
|
|
24
24
|
destroy: () => void;
|
|
25
25
|
initialFrame: WrappedCanvas | null;
|
|
26
26
|
isDestroyed: () => boolean;
|
|
27
|
-
tryToSatisfySeek: (time: number) =>
|
|
27
|
+
tryToSatisfySeek: (time: number) => {
|
|
28
28
|
type: "not-satisfied";
|
|
29
29
|
reason: string;
|
|
30
30
|
} | {
|
|
31
31
|
type: "satisfied";
|
|
32
32
|
frame: WrappedCanvas;
|
|
33
|
-
}
|
|
33
|
+
};
|
|
34
34
|
} | null;
|
|
35
35
|
drawFrame: (frame: WrappedCanvas) => void;
|
|
36
36
|
getFramesRendered: () => number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remotion/media",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.453",
|
|
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.453",
|
|
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.453",
|
|
35
35
|
"@vitest/browser-webdriverio": "4.0.9",
|
|
36
36
|
"eslint": "9.19.0",
|
|
37
37
|
"react": "19.2.3",
|
|
@@ -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;
|