@remotion/media 4.0.435 → 4.0.437
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/audio-for-preview.d.ts +1 -0
- package/dist/audio/audio-preview-iterator.d.ts +18 -10
- package/dist/audio/props.d.ts +1 -0
- package/dist/audio-extraction/extract-audio.d.ts +1 -0
- package/dist/audio-iterator-manager.d.ts +5 -3
- package/dist/debug-overlay/preview-overlay.d.ts +3 -2
- package/dist/esm/index.mjs +94 -48
- package/dist/extract-frame-and-audio.d.ts +2 -1
- package/dist/get-sink.d.ts +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/media-player.d.ts +2 -1
- package/dist/video/props.d.ts +1 -0
- package/dist/video/video-for-preview.d.ts +1 -0
- package/dist/video/video-for-rendering.d.ts +1 -0
- package/dist/video/video.d.ts +1 -0
- package/dist/video-extraction/add-broadcast-channel-listener.d.ts +1 -0
- package/dist/video-extraction/extract-frame-via-broadcast-channel.d.ts +2 -1
- package/dist/video-extraction/extract-frame.d.ts +1 -0
- package/dist/video-extraction/get-frames-since-keyframe.d.ts +1 -1
- package/package.json +4 -4
|
@@ -27,6 +27,7 @@ type InnerAudioProps = {
|
|
|
27
27
|
readonly fallbackHtml5AudioProps?: FallbackHtml5AudioProps;
|
|
28
28
|
readonly debugAudioScheduling?: boolean;
|
|
29
29
|
readonly onError?: MediaOnError;
|
|
30
|
+
readonly credentials?: RequestCredentials;
|
|
30
31
|
};
|
|
31
32
|
export declare const AudioForPreview: React.FC<InnerAudioProps & {
|
|
32
33
|
readonly controls: SequenceControls | undefined;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { WrappedAudioBuffer } from 'mediabunny';
|
|
2
|
+
import type { SharedAudioContextForMediaPlayer } from '../shared-audio-context-for-media-player';
|
|
2
3
|
export declare const HEALTHY_BUFFER_THRESHOLD_SECONDS = 1;
|
|
3
4
|
export type QueuedNode = {
|
|
4
5
|
node: AudioBufferSourceNode;
|
|
@@ -6,28 +7,35 @@ export type QueuedNode = {
|
|
|
6
7
|
buffer: AudioBuffer;
|
|
7
8
|
scheduledTime: number;
|
|
8
9
|
playbackRate: number;
|
|
10
|
+
scheduledAtAnchor: number;
|
|
9
11
|
};
|
|
10
12
|
export type QueuedPeriod = {
|
|
11
13
|
from: number;
|
|
12
14
|
until: number;
|
|
13
15
|
};
|
|
14
|
-
export declare const makeAudioIterator: (startFromSecond
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
|
|
16
|
+
export declare const makeAudioIterator: ({ startFromSecond, maximumTimestamp, cache, debugAudioScheduling, }: {
|
|
17
|
+
startFromSecond: number;
|
|
18
|
+
maximumTimestamp: number;
|
|
19
|
+
cache: {
|
|
20
|
+
prewarmIteratorForLooping: ({ timeToSeek, maximumTimestamp, }: {
|
|
21
|
+
timeToSeek: number;
|
|
22
|
+
maximumTimestamp: number;
|
|
23
|
+
}) => void;
|
|
24
|
+
makeIteratorOrUsePrewarmed: (timeToSeek: number, maximumTimestamp: number) => AsyncGenerator<WrappedAudioBuffer, void, unknown>;
|
|
25
|
+
destroy: () => void;
|
|
26
|
+
};
|
|
27
|
+
debugAudioScheduling: boolean;
|
|
28
|
+
}) => {
|
|
29
|
+
destroy: (audioContext: SharedAudioContextForMediaPlayer) => void;
|
|
23
30
|
getNext: () => Promise<IteratorResult<WrappedAudioBuffer, void>>;
|
|
24
31
|
isDestroyed: () => boolean;
|
|
25
|
-
addQueuedAudioNode: ({ node, timestamp, buffer, scheduledTime, playbackRate, }: {
|
|
32
|
+
addQueuedAudioNode: ({ node, timestamp, buffer, scheduledTime, playbackRate, scheduledAtAnchor, }: {
|
|
26
33
|
node: AudioBufferSourceNode;
|
|
27
34
|
timestamp: number;
|
|
28
35
|
buffer: AudioBuffer;
|
|
29
36
|
scheduledTime: number;
|
|
30
37
|
playbackRate: number;
|
|
38
|
+
scheduledAtAnchor: number;
|
|
31
39
|
}) => void;
|
|
32
40
|
removeQueuedAudioNode: (node: AudioBufferSourceNode) => void;
|
|
33
41
|
getAndClearAudioChunksForAfterResuming: () => {
|
package/dist/audio/props.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ type ExtractAudioParams = {
|
|
|
12
12
|
trimAfter: number | undefined;
|
|
13
13
|
fps: number;
|
|
14
14
|
maxCacheSize: number;
|
|
15
|
+
credentials: RequestCredentials | undefined;
|
|
15
16
|
};
|
|
16
17
|
export declare const extractAudio: (params: ExtractAudioParams) => Promise<"cannot-decode" | "network-error" | "unknown-container-format" | {
|
|
17
18
|
data: PcmS16AudioData | null;
|
|
@@ -2,11 +2,12 @@ import type { InputAudioTrack, WrappedAudioBuffer } from 'mediabunny';
|
|
|
2
2
|
import { type ScheduleAudioNodeResult } from 'remotion';
|
|
3
3
|
import type { DelayPlaybackIfNotPremounting } from './delay-playback-if-not-premounting';
|
|
4
4
|
import type { Nonce } from './nonce-manager';
|
|
5
|
+
import type { SharedAudioContextForMediaPlayer } from './shared-audio-context-for-media-player';
|
|
5
6
|
type ScheduleAudioNode = (node: AudioBufferSourceNode, mediaTimestamp: number) => ScheduleAudioNodeResult;
|
|
6
7
|
export declare const audioIteratorManager: ({ audioTrack, delayPlaybackHandleIfNotPremounting, sharedAudioContext, getIsLooping, getEndTime, getStartTime, initialMuted, drawDebugOverlay, }: {
|
|
7
8
|
audioTrack: InputAudioTrack;
|
|
8
9
|
delayPlaybackHandleIfNotPremounting: () => DelayPlaybackIfNotPremounting;
|
|
9
|
-
sharedAudioContext:
|
|
10
|
+
sharedAudioContext: SharedAudioContextForMediaPlayer;
|
|
10
11
|
getIsLooping: () => boolean;
|
|
11
12
|
getEndTime: () => number;
|
|
12
13
|
getStartTime: () => number;
|
|
@@ -28,15 +29,16 @@ export declare const audioIteratorManager: ({ audioTrack, delayPlaybackHandleIfN
|
|
|
28
29
|
}) => void;
|
|
29
30
|
pausePlayback: () => void;
|
|
30
31
|
getAudioBufferIterator: () => {
|
|
31
|
-
destroy: (audioContext:
|
|
32
|
+
destroy: (audioContext: SharedAudioContextForMediaPlayer) => void;
|
|
32
33
|
getNext: () => Promise<IteratorResult<WrappedAudioBuffer, void>>;
|
|
33
34
|
isDestroyed: () => boolean;
|
|
34
|
-
addQueuedAudioNode: ({ node, timestamp, buffer, scheduledTime, playbackRate, }: {
|
|
35
|
+
addQueuedAudioNode: ({ node, timestamp, buffer, scheduledTime, playbackRate, scheduledAtAnchor, }: {
|
|
35
36
|
node: AudioBufferSourceNode;
|
|
36
37
|
timestamp: number;
|
|
37
38
|
buffer: AudioBuffer;
|
|
38
39
|
scheduledTime: number;
|
|
39
40
|
playbackRate: number;
|
|
41
|
+
scheduledAtAnchor: number;
|
|
40
42
|
}) => void;
|
|
41
43
|
removeQueuedAudioNode: (node: AudioBufferSourceNode) => void;
|
|
42
44
|
getAndClearAudioChunksForAfterResuming: () => {
|
|
@@ -22,15 +22,16 @@ export declare const drawPreviewOverlay: ({ context, audioTime, audioContextStat
|
|
|
22
22
|
}) => void;
|
|
23
23
|
pausePlayback: () => void;
|
|
24
24
|
getAudioBufferIterator: () => {
|
|
25
|
-
destroy: (audioContext:
|
|
25
|
+
destroy: (audioContext: import("../shared-audio-context-for-media-player").SharedAudioContextForMediaPlayer) => void;
|
|
26
26
|
getNext: () => Promise<IteratorResult<import("mediabunny").WrappedAudioBuffer, void>>;
|
|
27
27
|
isDestroyed: () => boolean;
|
|
28
|
-
addQueuedAudioNode: ({ node, timestamp, buffer, scheduledTime, playbackRate, }: {
|
|
28
|
+
addQueuedAudioNode: ({ node, timestamp, buffer, scheduledTime, playbackRate, scheduledAtAnchor, }: {
|
|
29
29
|
node: AudioBufferSourceNode;
|
|
30
30
|
timestamp: number;
|
|
31
31
|
buffer: AudioBuffer;
|
|
32
32
|
scheduledTime: number;
|
|
33
33
|
playbackRate: number;
|
|
34
|
+
scheduledAtAnchor: number;
|
|
34
35
|
}) => void;
|
|
35
36
|
removeQueuedAudioNode: (node: AudioBufferSourceNode) => void;
|
|
36
37
|
getAndClearAudioChunksForAfterResuming: () => {
|
package/dist/esm/index.mjs
CHANGED
|
@@ -139,7 +139,12 @@ var setGlobalTimeAnchor = ({
|
|
|
139
139
|
};
|
|
140
140
|
|
|
141
141
|
// src/audio/audio-preview-iterator.ts
|
|
142
|
-
var makeAudioIterator = (
|
|
142
|
+
var makeAudioIterator = ({
|
|
143
|
+
startFromSecond,
|
|
144
|
+
maximumTimestamp,
|
|
145
|
+
cache,
|
|
146
|
+
debugAudioScheduling
|
|
147
|
+
}) => {
|
|
143
148
|
let destroyed = false;
|
|
144
149
|
const iterator = cache.makeIteratorOrUsePrewarmed(startFromSecond, maximumTimestamp);
|
|
145
150
|
const queuedAudioNodes = [];
|
|
@@ -149,15 +154,15 @@ var makeAudioIterator = (startFromSecond, maximumTimestamp, cache, debugAudioSch
|
|
|
149
154
|
const cleanupAudioQueue = (audioContext) => {
|
|
150
155
|
for (const node of queuedAudioNodes) {
|
|
151
156
|
try {
|
|
152
|
-
const
|
|
153
|
-
const
|
|
154
|
-
|
|
155
|
-
const shouldKeep = isAlreadyPlaying;
|
|
156
|
-
if (shouldKeep) {
|
|
157
|
+
const isAlreadyPlaying = node.scheduledTime - ALLOWED_GLOBAL_TIME_ANCHOR_SHIFT < audioContext.audioContext.currentTime;
|
|
158
|
+
const wasScheduledForThisAnchor = node.scheduledAtAnchor === audioContext.audioSyncAnchor.value;
|
|
159
|
+
if (isAlreadyPlaying && wasScheduledForThisAnchor) {
|
|
157
160
|
continue;
|
|
158
161
|
}
|
|
159
162
|
if (debugAudioScheduling) {
|
|
160
|
-
|
|
163
|
+
const currentlyHearing = audioContext.audioContext.getOutputTimestamp().contextTime;
|
|
164
|
+
const nodeEndTime = node.scheduledTime + node.buffer.duration / node.playbackRate;
|
|
165
|
+
Internals3.Log.info({ logLevel: "trace", tag: "audio-scheduling" }, `Stopping node ${node.timestamp.toFixed(3)}, currently hearing = ${currentlyHearing.toFixed(3)} currentTime = ${audioContext.audioContext.currentTime.toFixed(3)} nodeEndTime = ${nodeEndTime.toFixed(3)} scheduledTime = ${node.scheduledTime.toFixed(3)}`);
|
|
161
166
|
}
|
|
162
167
|
node.node.stop();
|
|
163
168
|
} catch {}
|
|
@@ -318,14 +323,16 @@ var makeAudioIterator = (startFromSecond, maximumTimestamp, cache, debugAudioSch
|
|
|
318
323
|
timestamp,
|
|
319
324
|
buffer,
|
|
320
325
|
scheduledTime,
|
|
321
|
-
playbackRate
|
|
326
|
+
playbackRate,
|
|
327
|
+
scheduledAtAnchor
|
|
322
328
|
}) => {
|
|
323
329
|
queuedAudioNodes.push({
|
|
324
330
|
node,
|
|
325
331
|
timestamp,
|
|
326
332
|
buffer,
|
|
327
333
|
scheduledTime,
|
|
328
|
-
playbackRate
|
|
334
|
+
playbackRate,
|
|
335
|
+
scheduledAtAnchor
|
|
329
336
|
});
|
|
330
337
|
},
|
|
331
338
|
removeQueuedAudioNode: (node) => {
|
|
@@ -570,8 +577,8 @@ var audioIteratorManager = ({
|
|
|
570
577
|
}) => {
|
|
571
578
|
let muted = initialMuted;
|
|
572
579
|
let currentVolume = 1;
|
|
573
|
-
const gainNode = sharedAudioContext.createGain();
|
|
574
|
-
gainNode.connect(sharedAudioContext.destination);
|
|
580
|
+
const gainNode = sharedAudioContext.audioContext.createGain();
|
|
581
|
+
gainNode.connect(sharedAudioContext.audioContext.destination);
|
|
575
582
|
const audioSink = new AudioBufferSink(audioTrack);
|
|
576
583
|
const prewarmedAudioIteratorCache = makePrewarmedAudioIteratorCache(audioSink);
|
|
577
584
|
let audioBufferIterator = null;
|
|
@@ -587,13 +594,13 @@ var audioIteratorManager = ({
|
|
|
587
594
|
if (!audioBufferIterator) {
|
|
588
595
|
throw new Error("Audio buffer iterator not found");
|
|
589
596
|
}
|
|
590
|
-
if (sharedAudioContext.state !== "running") {
|
|
597
|
+
if (sharedAudioContext.audioContext.state !== "running") {
|
|
591
598
|
throw new Error("Tried to schedule node while audio context is not running");
|
|
592
599
|
}
|
|
593
600
|
if (muted) {
|
|
594
601
|
return;
|
|
595
602
|
}
|
|
596
|
-
const node = sharedAudioContext.createBufferSource();
|
|
603
|
+
const node = sharedAudioContext.audioContext.createBufferSource();
|
|
597
604
|
node.buffer = buffer;
|
|
598
605
|
node.playbackRate.value = playbackRate;
|
|
599
606
|
node.connect(gainNode);
|
|
@@ -611,7 +618,8 @@ var audioIteratorManager = ({
|
|
|
611
618
|
timestamp: mediaTimestamp,
|
|
612
619
|
buffer,
|
|
613
620
|
scheduledTime: started.scheduledTime,
|
|
614
|
-
playbackRate
|
|
621
|
+
playbackRate,
|
|
622
|
+
scheduledAtAnchor: sharedAudioContext.audioSyncAnchor.value
|
|
615
623
|
});
|
|
616
624
|
node.onended = () => {
|
|
617
625
|
setTimeout(() => {
|
|
@@ -658,7 +666,7 @@ var audioIteratorManager = ({
|
|
|
658
666
|
if (buffer.timestamp >= endTime) {
|
|
659
667
|
return;
|
|
660
668
|
}
|
|
661
|
-
if (getIsPlaying() && sharedAudioContext.state === "running" && (sharedAudioContext.getOutputTimestamp().contextTime ?? 0) > 0) {
|
|
669
|
+
if (getIsPlaying() && sharedAudioContext.audioContext.state === "running" && (sharedAudioContext.audioContext.getOutputTimestamp().contextTime ?? 0) > 0) {
|
|
662
670
|
resumeScheduledAudioChunks({
|
|
663
671
|
playbackRate,
|
|
664
672
|
scheduleAudioNode,
|
|
@@ -698,7 +706,12 @@ var audioIteratorManager = ({
|
|
|
698
706
|
audioBufferIterator?.destroy(sharedAudioContext);
|
|
699
707
|
const delayHandle = __using(__stack, delayPlaybackHandleIfNotPremounting(), 0);
|
|
700
708
|
currentDelayHandle = delayHandle;
|
|
701
|
-
const iterator = makeAudioIterator(
|
|
709
|
+
const iterator = makeAudioIterator({
|
|
710
|
+
startFromSecond,
|
|
711
|
+
maximumTimestamp: getEndTime(),
|
|
712
|
+
cache: prewarmedAudioIteratorCache,
|
|
713
|
+
debugAudioScheduling
|
|
714
|
+
});
|
|
702
715
|
audioIteratorsCreated++;
|
|
703
716
|
audioBufferIterator = iterator;
|
|
704
717
|
try {
|
|
@@ -782,7 +795,7 @@ var audioIteratorManager = ({
|
|
|
782
795
|
}
|
|
783
796
|
const queuedPeriod = audioBufferIterator.getQueuedPeriod();
|
|
784
797
|
const queuedPeriodMinusLatency = queuedPeriod ? {
|
|
785
|
-
from: queuedPeriod.from - ALLOWED_GLOBAL_TIME_ANCHOR_SHIFT - sharedAudioContext.baseLatency - sharedAudioContext.outputLatency,
|
|
798
|
+
from: queuedPeriod.from - ALLOWED_GLOBAL_TIME_ANCHOR_SHIFT - sharedAudioContext.audioContext.baseLatency - sharedAudioContext.audioContext.outputLatency,
|
|
786
799
|
until: queuedPeriod.until
|
|
787
800
|
} : null;
|
|
788
801
|
const currentTimeIsAlreadyQueued = isAlreadyQueued(newTime, queuedPeriodMinusLatency);
|
|
@@ -1222,7 +1235,8 @@ class MediaPlayer {
|
|
|
1222
1235
|
durationInFrames,
|
|
1223
1236
|
onVideoFrameCallback,
|
|
1224
1237
|
playing,
|
|
1225
|
-
sequenceOffset
|
|
1238
|
+
sequenceOffset,
|
|
1239
|
+
credentials
|
|
1226
1240
|
}) {
|
|
1227
1241
|
this.canvas = canvas ?? null;
|
|
1228
1242
|
this.src = src;
|
|
@@ -1246,7 +1260,9 @@ class MediaPlayer {
|
|
|
1246
1260
|
this.playing = playing;
|
|
1247
1261
|
this.sequenceOffset = sequenceOffset;
|
|
1248
1262
|
this.input = new Input({
|
|
1249
|
-
source: new UrlSource(this.src
|
|
1263
|
+
source: new UrlSource(this.src, credentials ? {
|
|
1264
|
+
requestInit: { credentials }
|
|
1265
|
+
} : undefined),
|
|
1250
1266
|
formats: ALL_FORMATS
|
|
1251
1267
|
});
|
|
1252
1268
|
if (canvas) {
|
|
@@ -1360,7 +1376,7 @@ class MediaPlayer {
|
|
|
1360
1376
|
this.audioIteratorManager = audioIteratorManager({
|
|
1361
1377
|
audioTrack,
|
|
1362
1378
|
delayPlaybackHandleIfNotPremounting: this.delayPlaybackHandleIfNotPremounting,
|
|
1363
|
-
sharedAudioContext: this.sharedAudioContext
|
|
1379
|
+
sharedAudioContext: this.sharedAudioContext,
|
|
1364
1380
|
getIsLooping: () => this.loop,
|
|
1365
1381
|
getEndTime: () => this.getEndTime(),
|
|
1366
1382
|
getStartTime: () => this.getStartTime(),
|
|
@@ -2046,6 +2062,7 @@ var AudioForPreviewAssertedShowing = ({
|
|
|
2046
2062
|
fallbackHtml5AudioProps,
|
|
2047
2063
|
debugAudioScheduling,
|
|
2048
2064
|
onError,
|
|
2065
|
+
credentials,
|
|
2049
2066
|
controls
|
|
2050
2067
|
}) => {
|
|
2051
2068
|
const videoConfig = useUnsafeVideoConfig();
|
|
@@ -2172,7 +2189,8 @@ var AudioForPreviewAssertedShowing = ({
|
|
|
2172
2189
|
durationInFrames: videoConfig.durationInFrames,
|
|
2173
2190
|
onVideoFrameCallback: null,
|
|
2174
2191
|
playing: initialPlaying.current,
|
|
2175
|
-
sequenceOffset: initialSequenceOffset.current
|
|
2192
|
+
sequenceOffset: initialSequenceOffset.current,
|
|
2193
|
+
credentials
|
|
2176
2194
|
});
|
|
2177
2195
|
mediaPlayerRef.current = player;
|
|
2178
2196
|
player.initialize(currentTimeRef.current, initialMuted.current).then((result) => {
|
|
@@ -2264,7 +2282,8 @@ var AudioForPreviewAssertedShowing = ({
|
|
|
2264
2282
|
debugAudioScheduling,
|
|
2265
2283
|
buffer,
|
|
2266
2284
|
onError,
|
|
2267
|
-
videoConfig.durationInFrames
|
|
2285
|
+
videoConfig.durationInFrames,
|
|
2286
|
+
credentials
|
|
2268
2287
|
]);
|
|
2269
2288
|
if (shouldFallbackToNativeAudio && !disallowFallbackToHtml5Audio) {
|
|
2270
2289
|
return /* @__PURE__ */ jsx(RemotionAudio, {
|
|
@@ -2307,6 +2326,7 @@ var AudioForPreview = ({
|
|
|
2307
2326
|
fallbackHtml5AudioProps,
|
|
2308
2327
|
debugAudioScheduling,
|
|
2309
2328
|
onError,
|
|
2329
|
+
credentials,
|
|
2310
2330
|
controls
|
|
2311
2331
|
}) => {
|
|
2312
2332
|
const preloadedSrc = usePreload(src);
|
|
@@ -2356,6 +2376,7 @@ var AudioForPreview = ({
|
|
|
2356
2376
|
toneFrequency,
|
|
2357
2377
|
debugAudioScheduling: debugAudioScheduling ?? false,
|
|
2358
2378
|
onError,
|
|
2379
|
+
credentials,
|
|
2359
2380
|
fallbackHtml5AudioProps,
|
|
2360
2381
|
controls
|
|
2361
2382
|
});
|
|
@@ -3525,11 +3546,12 @@ var getFormatOrNullOrNetworkError = async (input) => {
|
|
|
3525
3546
|
return null;
|
|
3526
3547
|
}
|
|
3527
3548
|
};
|
|
3528
|
-
var getSinks = async (src) => {
|
|
3549
|
+
var getSinks = async (src, credentials) => {
|
|
3529
3550
|
const input = new Input2({
|
|
3530
3551
|
formats: ALL_FORMATS2,
|
|
3531
3552
|
source: new UrlSource2(src, {
|
|
3532
|
-
getRetryDelay
|
|
3553
|
+
getRetryDelay,
|
|
3554
|
+
...credentials ? { requestInit: { credentials } } : undefined
|
|
3533
3555
|
})
|
|
3534
3556
|
});
|
|
3535
3557
|
const format = await getFormatOrNullOrNetworkError(input);
|
|
@@ -3611,15 +3633,16 @@ var getSinks = async (src) => {
|
|
|
3611
3633
|
|
|
3612
3634
|
// src/get-sink.ts
|
|
3613
3635
|
var sinkPromises = {};
|
|
3614
|
-
var getSink = (src, logLevel) => {
|
|
3615
|
-
|
|
3636
|
+
var getSink = (src, logLevel, credentials) => {
|
|
3637
|
+
const cacheKey = credentials ? `${src}::${credentials}` : src;
|
|
3638
|
+
let promise = sinkPromises[cacheKey];
|
|
3616
3639
|
if (!promise) {
|
|
3617
3640
|
Internals16.Log.verbose({
|
|
3618
3641
|
logLevel,
|
|
3619
3642
|
tag: "@remotion/media"
|
|
3620
3643
|
}, `Sink for ${src} was not found, creating new sink`);
|
|
3621
|
-
promise = getSinks(src);
|
|
3622
|
-
sinkPromises[
|
|
3644
|
+
promise = getSinks(src, credentials);
|
|
3645
|
+
sinkPromises[cacheKey] = promise;
|
|
3623
3646
|
}
|
|
3624
3647
|
return promise;
|
|
3625
3648
|
};
|
|
@@ -3636,9 +3659,10 @@ var extractAudioInternal = async ({
|
|
|
3636
3659
|
trimBefore,
|
|
3637
3660
|
trimAfter,
|
|
3638
3661
|
fps,
|
|
3639
|
-
maxCacheSize
|
|
3662
|
+
maxCacheSize,
|
|
3663
|
+
credentials
|
|
3640
3664
|
}) => {
|
|
3641
|
-
const { getAudio, actualMatroskaTimestamps, isMatroska, getDuration } = await getSink(src, logLevel);
|
|
3665
|
+
const { getAudio, actualMatroskaTimestamps, isMatroska, getDuration } = await getSink(src, logLevel, credentials);
|
|
3642
3666
|
let mediaDurationInSeconds = null;
|
|
3643
3667
|
if (loop) {
|
|
3644
3668
|
mediaDurationInSeconds = await getDuration();
|
|
@@ -3764,9 +3788,10 @@ var extractFrameInternal = async ({
|
|
|
3764
3788
|
trimBefore,
|
|
3765
3789
|
playbackRate,
|
|
3766
3790
|
fps,
|
|
3767
|
-
maxCacheSize
|
|
3791
|
+
maxCacheSize,
|
|
3792
|
+
credentials
|
|
3768
3793
|
}) => {
|
|
3769
|
-
const sink = await getSink(src, logLevel);
|
|
3794
|
+
const sink = await getSink(src, logLevel, credentials);
|
|
3770
3795
|
const [video, mediaDurationInSecondsRaw] = await Promise.all([
|
|
3771
3796
|
sink.getVideo(),
|
|
3772
3797
|
loop ? sink.getDuration() : Promise.resolve(null)
|
|
@@ -3892,7 +3917,8 @@ var extractFrameAndAudio = async ({
|
|
|
3892
3917
|
trimAfter,
|
|
3893
3918
|
trimBefore,
|
|
3894
3919
|
fps,
|
|
3895
|
-
maxCacheSize
|
|
3920
|
+
maxCacheSize,
|
|
3921
|
+
credentials
|
|
3896
3922
|
}) => {
|
|
3897
3923
|
try {
|
|
3898
3924
|
const [video, audio] = await Promise.all([
|
|
@@ -3905,7 +3931,8 @@ var extractFrameAndAudio = async ({
|
|
|
3905
3931
|
playbackRate,
|
|
3906
3932
|
trimBefore,
|
|
3907
3933
|
fps,
|
|
3908
|
-
maxCacheSize
|
|
3934
|
+
maxCacheSize,
|
|
3935
|
+
credentials
|
|
3909
3936
|
}) : null,
|
|
3910
3937
|
includeAudio ? extractAudio({
|
|
3911
3938
|
src,
|
|
@@ -3918,7 +3945,8 @@ var extractFrameAndAudio = async ({
|
|
|
3918
3945
|
trimAfter,
|
|
3919
3946
|
fps,
|
|
3920
3947
|
trimBefore,
|
|
3921
|
-
maxCacheSize
|
|
3948
|
+
maxCacheSize,
|
|
3949
|
+
credentials
|
|
3922
3950
|
}) : null
|
|
3923
3951
|
]);
|
|
3924
3952
|
if (video?.type === "cannot-decode") {
|
|
@@ -4001,7 +4029,8 @@ var addBroadcastChannelListener = () => {
|
|
|
4001
4029
|
trimAfter: data.trimAfter,
|
|
4002
4030
|
trimBefore: data.trimBefore,
|
|
4003
4031
|
fps: data.fps,
|
|
4004
|
-
maxCacheSize: data.maxCacheSize
|
|
4032
|
+
maxCacheSize: data.maxCacheSize,
|
|
4033
|
+
credentials: data.credentials
|
|
4005
4034
|
});
|
|
4006
4035
|
if (result.type === "cannot-decode") {
|
|
4007
4036
|
const cannotDecodeResponse = {
|
|
@@ -4098,7 +4127,8 @@ var extractFrameViaBroadcastChannel = async ({
|
|
|
4098
4127
|
trimAfter,
|
|
4099
4128
|
trimBefore,
|
|
4100
4129
|
fps,
|
|
4101
|
-
maxCacheSize
|
|
4130
|
+
maxCacheSize,
|
|
4131
|
+
credentials
|
|
4102
4132
|
}) => {
|
|
4103
4133
|
if (isClientSideRendering || window.remotion_isMainTab) {
|
|
4104
4134
|
return extractFrameAndAudio({
|
|
@@ -4114,7 +4144,8 @@ var extractFrameViaBroadcastChannel = async ({
|
|
|
4114
4144
|
trimAfter,
|
|
4115
4145
|
trimBefore,
|
|
4116
4146
|
fps,
|
|
4117
|
-
maxCacheSize
|
|
4147
|
+
maxCacheSize,
|
|
4148
|
+
credentials
|
|
4118
4149
|
});
|
|
4119
4150
|
}
|
|
4120
4151
|
await waitForMainTabToBeReady(window.remotion_broadcastChannel);
|
|
@@ -4191,7 +4222,8 @@ var extractFrameViaBroadcastChannel = async ({
|
|
|
4191
4222
|
trimAfter,
|
|
4192
4223
|
trimBefore,
|
|
4193
4224
|
fps,
|
|
4194
|
-
maxCacheSize
|
|
4225
|
+
maxCacheSize,
|
|
4226
|
+
credentials
|
|
4195
4227
|
};
|
|
4196
4228
|
window.remotion_broadcastChannel.postMessage(request);
|
|
4197
4229
|
let timeoutId;
|
|
@@ -4229,7 +4261,8 @@ var AudioForRendering = ({
|
|
|
4229
4261
|
toneFrequency,
|
|
4230
4262
|
trimAfter,
|
|
4231
4263
|
trimBefore,
|
|
4232
|
-
onError
|
|
4264
|
+
onError,
|
|
4265
|
+
credentials
|
|
4233
4266
|
}) => {
|
|
4234
4267
|
const defaultLogLevel = Internals18.useLogLevel();
|
|
4235
4268
|
const logLevel = overriddenLogLevel ?? defaultLogLevel;
|
|
@@ -4293,7 +4326,8 @@ var AudioForRendering = ({
|
|
|
4293
4326
|
trimAfter,
|
|
4294
4327
|
trimBefore,
|
|
4295
4328
|
fps,
|
|
4296
|
-
maxCacheSize
|
|
4329
|
+
maxCacheSize,
|
|
4330
|
+
credentials
|
|
4297
4331
|
}).then((result) => {
|
|
4298
4332
|
const handleError = (error, clientSideError, fallbackMessage) => {
|
|
4299
4333
|
const [action, errorToUse] = callOnErrorAndResolve({
|
|
@@ -4387,7 +4421,8 @@ var AudioForRendering = ({
|
|
|
4387
4421
|
replaceWithHtml5Audio,
|
|
4388
4422
|
maxCacheSize,
|
|
4389
4423
|
audioEnabled,
|
|
4390
|
-
onError
|
|
4424
|
+
onError,
|
|
4425
|
+
credentials
|
|
4391
4426
|
]);
|
|
4392
4427
|
if (replaceWithHtml5Audio) {
|
|
4393
4428
|
return /* @__PURE__ */ jsx2(Html5Audio, {
|
|
@@ -4511,6 +4546,7 @@ var VideoForPreviewAssertedShowing = ({
|
|
|
4511
4546
|
debugAudioScheduling,
|
|
4512
4547
|
headless,
|
|
4513
4548
|
onError,
|
|
4549
|
+
credentials,
|
|
4514
4550
|
controls
|
|
4515
4551
|
}) => {
|
|
4516
4552
|
const src = usePreload2(unpreloadedSrc);
|
|
@@ -4614,7 +4650,8 @@ var VideoForPreviewAssertedShowing = ({
|
|
|
4614
4650
|
durationInFrames: videoConfig.durationInFrames,
|
|
4615
4651
|
onVideoFrameCallback: initialOnVideoFrameRef.current ?? null,
|
|
4616
4652
|
playing: initialPlaying.current,
|
|
4617
|
-
sequenceOffset: initialSequenceOffset.current
|
|
4653
|
+
sequenceOffset: initialSequenceOffset.current,
|
|
4654
|
+
credentials
|
|
4618
4655
|
});
|
|
4619
4656
|
mediaPlayerRef.current = player;
|
|
4620
4657
|
player.initialize(currentTimeRef.current, initialMuted.current).then((result) => {
|
|
@@ -4704,7 +4741,8 @@ var VideoForPreviewAssertedShowing = ({
|
|
|
4704
4741
|
sharedAudioContext,
|
|
4705
4742
|
videoConfig.fps,
|
|
4706
4743
|
onError,
|
|
4707
|
-
videoConfig.durationInFrames
|
|
4744
|
+
videoConfig.durationInFrames,
|
|
4745
|
+
credentials
|
|
4708
4746
|
]);
|
|
4709
4747
|
const classNameValue = useMemo4(() => {
|
|
4710
4748
|
return [Internals20.OBJECTFIT_CONTAIN_CLASS_NAME, className].filter(Internals20.truthy).join(" ");
|
|
@@ -4855,7 +4893,8 @@ var VideoForRendering = ({
|
|
|
4855
4893
|
trimAfterValue,
|
|
4856
4894
|
trimBeforeValue,
|
|
4857
4895
|
headless,
|
|
4858
|
-
onError
|
|
4896
|
+
onError,
|
|
4897
|
+
credentials
|
|
4859
4898
|
}) => {
|
|
4860
4899
|
if (!src) {
|
|
4861
4900
|
throw new TypeError("No `src` was passed to <Video>.");
|
|
@@ -4922,7 +4961,8 @@ var VideoForRendering = ({
|
|
|
4922
4961
|
trimAfter: trimAfterValue,
|
|
4923
4962
|
trimBefore: trimBeforeValue,
|
|
4924
4963
|
fps,
|
|
4925
|
-
maxCacheSize
|
|
4964
|
+
maxCacheSize,
|
|
4965
|
+
credentials
|
|
4926
4966
|
}).then((result) => {
|
|
4927
4967
|
const handleError = (err, clientSideError, fallbackMessage, mediaDurationInSeconds) => {
|
|
4928
4968
|
if (environment.isClientSideRendering) {
|
|
@@ -5054,7 +5094,8 @@ var VideoForRendering = ({
|
|
|
5054
5094
|
maxCacheSize,
|
|
5055
5095
|
cancelRender3,
|
|
5056
5096
|
headless,
|
|
5057
|
-
onError
|
|
5097
|
+
onError,
|
|
5098
|
+
credentials
|
|
5058
5099
|
]);
|
|
5059
5100
|
const classNameValue = useMemo5(() => {
|
|
5060
5101
|
return [Internals21.OBJECTFIT_CONTAIN_CLASS_NAME, className].filter(Internals21.truthy).join(" ");
|
|
@@ -5196,6 +5237,7 @@ var InnerVideo = ({
|
|
|
5196
5237
|
debugAudioScheduling,
|
|
5197
5238
|
headless,
|
|
5198
5239
|
onError,
|
|
5240
|
+
credentials,
|
|
5199
5241
|
controls
|
|
5200
5242
|
}) => {
|
|
5201
5243
|
const environment = useRemotionEnvironment4();
|
|
@@ -5238,7 +5280,8 @@ var InnerVideo = ({
|
|
|
5238
5280
|
trimAfterValue,
|
|
5239
5281
|
trimBeforeValue,
|
|
5240
5282
|
headless,
|
|
5241
|
-
onError
|
|
5283
|
+
onError,
|
|
5284
|
+
credentials
|
|
5242
5285
|
});
|
|
5243
5286
|
}
|
|
5244
5287
|
return /* @__PURE__ */ jsx6(VideoForPreview, {
|
|
@@ -5264,6 +5307,7 @@ var InnerVideo = ({
|
|
|
5264
5307
|
debugAudioScheduling: debugAudioScheduling ?? false,
|
|
5265
5308
|
headless: headless ?? false,
|
|
5266
5309
|
onError,
|
|
5310
|
+
credentials,
|
|
5267
5311
|
controls
|
|
5268
5312
|
});
|
|
5269
5313
|
};
|
|
@@ -5293,6 +5337,7 @@ var VideoInner = ({
|
|
|
5293
5337
|
debugAudioScheduling,
|
|
5294
5338
|
headless,
|
|
5295
5339
|
onError,
|
|
5340
|
+
credentials,
|
|
5296
5341
|
controls
|
|
5297
5342
|
}) => {
|
|
5298
5343
|
const fallbackLogLevel = Internals22.useLogLevel();
|
|
@@ -5322,6 +5367,7 @@ var VideoInner = ({
|
|
|
5322
5367
|
debugAudioScheduling: debugAudioScheduling ?? false,
|
|
5323
5368
|
headless: headless ?? false,
|
|
5324
5369
|
onError,
|
|
5370
|
+
credentials,
|
|
5325
5371
|
controls
|
|
5326
5372
|
});
|
|
5327
5373
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ExtractFrameViaBroadcastChannelResult } from './video-extraction/extract-frame-via-broadcast-channel';
|
|
2
|
-
export declare const extractFrameAndAudio: ({ src, timeInSeconds, logLevel, durationInSeconds, playbackRate, includeAudio, includeVideo, loop, audioStreamIndex, trimAfter, trimBefore, fps, maxCacheSize, }: {
|
|
2
|
+
export declare const extractFrameAndAudio: ({ src, timeInSeconds, logLevel, durationInSeconds, playbackRate, includeAudio, includeVideo, loop, audioStreamIndex, trimAfter, trimBefore, fps, maxCacheSize, credentials, }: {
|
|
3
3
|
src: string;
|
|
4
4
|
timeInSeconds: number;
|
|
5
5
|
logLevel: "error" | "info" | "trace" | "verbose" | "warn";
|
|
@@ -13,4 +13,5 @@ export declare const extractFrameAndAudio: ({ src, timeInSeconds, logLevel, dura
|
|
|
13
13
|
trimBefore: number | undefined;
|
|
14
14
|
fps: number;
|
|
15
15
|
maxCacheSize: number;
|
|
16
|
+
credentials: RequestCredentials | undefined;
|
|
16
17
|
}) => Promise<ExtractFrameViaBroadcastChannelResult>;
|
package/dist/get-sink.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { GetSink } from './video-extraction/get-frames-since-keyframe';
|
|
2
2
|
export declare const sinkPromises: Record<string, Promise<GetSink>>;
|
|
3
|
-
export declare const getSink: (src: string, logLevel: "error" | "info" | "trace" | "verbose" | "warn") => Promise<{
|
|
3
|
+
export declare const getSink: (src: string, logLevel: "error" | "info" | "trace" | "verbose" | "warn", credentials: RequestCredentials | undefined) => Promise<{
|
|
4
4
|
getVideo: () => Promise<import("./video-extraction/get-frames-since-keyframe").VideoSinkResult>;
|
|
5
5
|
getAudio: (index: number) => Promise<import("./video-extraction/get-frames-since-keyframe").AudioSinkResult>;
|
|
6
6
|
actualMatroskaTimestamps: {
|
package/dist/index.d.ts
CHANGED
|
@@ -37,6 +37,7 @@ export declare const experimental_Video: import("react").ComponentType<{
|
|
|
37
37
|
debugAudioScheduling: boolean;
|
|
38
38
|
headless: boolean;
|
|
39
39
|
onError: import("./on-error").MediaOnError | undefined;
|
|
40
|
+
credentials: RequestCredentials | undefined;
|
|
40
41
|
}>>;
|
|
41
42
|
export { AudioForPreview } from './audio/audio-for-preview';
|
|
42
43
|
export { AudioProps, FallbackHtml5AudioProps } from './audio/props';
|
package/dist/media-player.d.ts
CHANGED
|
@@ -44,7 +44,7 @@ export declare class MediaPlayer {
|
|
|
44
44
|
private isPremounting;
|
|
45
45
|
private isPostmounting;
|
|
46
46
|
private seekPromiseChain;
|
|
47
|
-
constructor({ canvas, src, logLevel, sharedAudioContext, loop, trimBefore, trimAfter, playbackRate, globalPlaybackRate, audioStreamIndex, fps, debugOverlay, debugAudioScheduling, bufferState, isPremounting, isPostmounting, durationInFrames, onVideoFrameCallback, playing, sequenceOffset }: {
|
|
47
|
+
constructor({ canvas, src, logLevel, sharedAudioContext, loop, trimBefore, trimAfter, playbackRate, globalPlaybackRate, audioStreamIndex, fps, debugOverlay, debugAudioScheduling, bufferState, isPremounting, isPostmounting, durationInFrames, onVideoFrameCallback, playing, sequenceOffset, credentials }: {
|
|
48
48
|
canvas: HTMLCanvasElement | OffscreenCanvas | null;
|
|
49
49
|
src: string;
|
|
50
50
|
logLevel: LogLevel;
|
|
@@ -65,6 +65,7 @@ export declare class MediaPlayer {
|
|
|
65
65
|
onVideoFrameCallback: null | ((frame: CanvasImageSource) => void);
|
|
66
66
|
playing: boolean;
|
|
67
67
|
sequenceOffset: number;
|
|
68
|
+
credentials: RequestCredentials | undefined;
|
|
68
69
|
});
|
|
69
70
|
private input;
|
|
70
71
|
private isDisposalError;
|
package/dist/video/props.d.ts
CHANGED
|
@@ -48,6 +48,7 @@ type OptionalVideoProps = {
|
|
|
48
48
|
debugAudioScheduling: boolean;
|
|
49
49
|
headless: boolean;
|
|
50
50
|
onError: MediaOnError | undefined;
|
|
51
|
+
credentials: RequestCredentials | undefined;
|
|
51
52
|
};
|
|
52
53
|
export type InnerVideoProps = MandatoryVideoProps & OuterVideoProps & OptionalVideoProps;
|
|
53
54
|
export type VideoProps = MandatoryVideoProps & Partial<OuterVideoProps> & Partial<OptionalVideoProps>;
|
|
@@ -25,6 +25,7 @@ type VideoForPreviewProps = {
|
|
|
25
25
|
readonly debugAudioScheduling: boolean;
|
|
26
26
|
readonly headless: boolean;
|
|
27
27
|
readonly onError: MediaOnError | undefined;
|
|
28
|
+
readonly credentials: RequestCredentials | undefined;
|
|
28
29
|
};
|
|
29
30
|
export declare const VideoForPreview: React.FC<VideoForPreviewProps & {
|
|
30
31
|
readonly controls: SequenceControls | undefined;
|
|
@@ -25,6 +25,7 @@ type InnerVideoProps = {
|
|
|
25
25
|
readonly trimAfterValue: number | undefined;
|
|
26
26
|
readonly headless: boolean;
|
|
27
27
|
readonly onError: MediaOnError | undefined;
|
|
28
|
+
readonly credentials: RequestCredentials | undefined;
|
|
28
29
|
};
|
|
29
30
|
export declare const VideoForRendering: React.FC<InnerVideoProps>;
|
|
30
31
|
export {};
|
package/dist/video/video.d.ts
CHANGED
|
@@ -43,6 +43,7 @@ export type ExtractFrameRequest = {
|
|
|
43
43
|
trimBefore: number | undefined;
|
|
44
44
|
fps: number;
|
|
45
45
|
maxCacheSize: number;
|
|
46
|
+
credentials: RequestCredentials | undefined;
|
|
46
47
|
};
|
|
47
48
|
export declare const addBroadcastChannelListener: () => void;
|
|
48
49
|
export declare const waitForMainTabToBeReady: (channel: BroadcastChannel) => Promise<void>;
|
|
@@ -15,7 +15,7 @@ export type ExtractFrameViaBroadcastChannelResult = {
|
|
|
15
15
|
} | {
|
|
16
16
|
type: 'unknown-container-format';
|
|
17
17
|
};
|
|
18
|
-
export declare const extractFrameViaBroadcastChannel: ({ src, timeInSeconds, logLevel, durationInSeconds, playbackRate, includeAudio, includeVideo, isClientSideRendering, loop, audioStreamIndex, trimAfter, trimBefore, fps, maxCacheSize, }: {
|
|
18
|
+
export declare const extractFrameViaBroadcastChannel: ({ src, timeInSeconds, logLevel, durationInSeconds, playbackRate, includeAudio, includeVideo, isClientSideRendering, loop, audioStreamIndex, trimAfter, trimBefore, fps, maxCacheSize, credentials, }: {
|
|
19
19
|
src: string;
|
|
20
20
|
timeInSeconds: number;
|
|
21
21
|
durationInSeconds: number;
|
|
@@ -30,4 +30,5 @@ export declare const extractFrameViaBroadcastChannel: ({ src, timeInSeconds, log
|
|
|
30
30
|
trimBefore: number | undefined;
|
|
31
31
|
fps: number;
|
|
32
32
|
maxCacheSize: number;
|
|
33
|
+
credentials: RequestCredentials | undefined;
|
|
33
34
|
}) => Promise<ExtractFrameViaBroadcastChannelResult>;
|
|
@@ -7,7 +7,7 @@ type AudioSinks = {
|
|
|
7
7
|
};
|
|
8
8
|
export type AudioSinkResult = AudioSinks | 'no-audio-track' | 'cannot-decode-audio' | 'unknown-container-format' | 'network-error';
|
|
9
9
|
export type VideoSinkResult = VideoSinks | 'no-video-track' | 'cannot-decode' | 'cannot-decode-alpha' | 'unknown-container-format' | 'network-error';
|
|
10
|
-
export declare const getSinks: (src: string) => Promise<{
|
|
10
|
+
export declare const getSinks: (src: string, credentials: RequestCredentials | undefined) => Promise<{
|
|
11
11
|
getVideo: () => Promise<VideoSinkResult>;
|
|
12
12
|
getAudio: (index: number) => Promise<AudioSinkResult>;
|
|
13
13
|
actualMatroskaTimestamps: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remotion/media",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.437",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"module": "dist/esm/index.mjs",
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
"make": "tsgo && bun --env-file=../.env.bundle bundle.ts"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"mediabunny": "1.
|
|
26
|
-
"remotion": "4.0.
|
|
25
|
+
"mediabunny": "1.39.2",
|
|
26
|
+
"remotion": "4.0.437",
|
|
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.437",
|
|
35
35
|
"@vitest/browser-webdriverio": "4.0.9",
|
|
36
36
|
"eslint": "9.19.0",
|
|
37
37
|
"react": "19.2.3",
|