@remotion/media 4.0.466 → 4.0.468
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 +2 -0
- package/dist/audio/audio.d.ts +1 -0
- package/dist/audio/get-scheduled-time.d.ts +2 -1
- package/dist/audio/props.d.ts +6 -0
- package/dist/audio-extraction/extract-audio.d.ts +2 -0
- package/dist/audio-iterator-manager.d.ts +2 -3
- package/dist/debug-overlay/preview-overlay.d.ts +4 -5
- package/dist/esm/index.mjs +159 -45
- package/dist/extract-frame-and-audio.d.ts +3 -1
- package/dist/get-sink.d.ts +7 -1
- package/dist/index.d.ts +3 -0
- package/dist/media-player.d.ts +4 -3
- package/dist/request-init.d.ts +19 -0
- package/dist/video/props.d.ts +6 -0
- package/dist/video/video-for-preview.d.ts +2 -0
- package/dist/video/video-for-rendering.d.ts +2 -0
- package/dist/video/video.d.ts +1 -0
- package/dist/video-extraction/add-broadcast-channel-listener.d.ts +2 -0
- package/dist/video-extraction/extract-frame-via-broadcast-channel.d.ts +3 -1
- package/dist/video-extraction/extract-frame.d.ts +2 -0
- package/dist/video-extraction/get-frames-since-keyframe.d.ts +2 -1
- package/package.json +3 -3
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { LogLevel, LoopVolumeCurveBehavior, VolumeProp } from 'remotion';
|
|
3
3
|
import { type MediaOnError } from '../on-error';
|
|
4
|
+
import type { MediaRequestInit } from '../request-init';
|
|
4
5
|
import type { FallbackHtml5AudioProps } from './props';
|
|
5
6
|
type InnerAudioProps = {
|
|
6
7
|
readonly loop?: boolean;
|
|
@@ -27,6 +28,7 @@ type InnerAudioProps = {
|
|
|
27
28
|
readonly fallbackHtml5AudioProps?: FallbackHtml5AudioProps;
|
|
28
29
|
readonly onError?: MediaOnError;
|
|
29
30
|
readonly credentials?: RequestCredentials;
|
|
31
|
+
readonly requestInit?: MediaRequestInit;
|
|
30
32
|
readonly setMediaDurationInSeconds?: (durationInSeconds: number) => void;
|
|
31
33
|
};
|
|
32
34
|
export declare const AudioForPreview: React.FC<InnerAudioProps>;
|
package/dist/audio/audio.d.ts
CHANGED
|
@@ -20,4 +20,5 @@ export declare const Audio: React.ComponentType<{
|
|
|
20
20
|
delayRenderTimeoutInMilliseconds?: number | undefined;
|
|
21
21
|
onError?: import("../on-error").MediaOnError | undefined;
|
|
22
22
|
credentials?: RequestCredentials | undefined;
|
|
23
|
+
requestInit?: import("..").MediaRequestInit | undefined;
|
|
23
24
|
} & Pick<import("remotion").SequenceProps, "durationInFrames" | "from" | "hidden" | "name" | "showInTimeline">>;
|
|
@@ -10,8 +10,9 @@ export declare const getDurationOfNode: ({ bufferDuration, loopSegmentMediaEndTi
|
|
|
10
10
|
offset: number;
|
|
11
11
|
originalUnloopedMediaTimestamp: number;
|
|
12
12
|
}) => number;
|
|
13
|
-
export declare const
|
|
13
|
+
export declare const getTrimStartForAudioNode: ({ mediaTimestamp, targetTime, sequenceStartTime, combinedPlaybackRate, }: {
|
|
14
14
|
mediaTimestamp: number;
|
|
15
15
|
targetTime: number;
|
|
16
16
|
sequenceStartTime: number;
|
|
17
|
+
combinedPlaybackRate: number;
|
|
17
18
|
}) => number;
|
package/dist/audio/props.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { LogLevel, LoopVolumeCurveBehavior, SequenceProps, VolumeProp } from 'remotion';
|
|
2
2
|
import type { MediaOnError } from '../on-error';
|
|
3
|
+
import type { MediaRequestInit } from '../request-init';
|
|
3
4
|
export type FallbackHtml5AudioProps = {
|
|
4
5
|
crossOrigin?: '' | 'anonymous' | 'use-credentials' | undefined;
|
|
5
6
|
onError?: (err: Error) => void;
|
|
@@ -31,5 +32,10 @@ export type AudioProps = {
|
|
|
31
32
|
delayRenderRetries?: number;
|
|
32
33
|
delayRenderTimeoutInMilliseconds?: number;
|
|
33
34
|
onError?: MediaOnError;
|
|
35
|
+
/**
|
|
36
|
+
* @deprecated Use `requestInit={{credentials: ...}}` instead. If both are
|
|
37
|
+
* passed, `requestInit.credentials` wins over this prop.
|
|
38
|
+
*/
|
|
34
39
|
credentials?: RequestCredentials;
|
|
40
|
+
requestInit?: MediaRequestInit;
|
|
35
41
|
} & Pick<SequenceProps, 'from' | 'durationInFrames' | 'name' | 'showInTimeline' | 'hidden'>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type LogLevel } from 'remotion';
|
|
2
2
|
import type { PcmS16AudioData } from '../convert-audiodata/convert-audiodata';
|
|
3
|
+
import type { MediaRequestInit } from '../request-init';
|
|
3
4
|
type ExtractAudioParams = {
|
|
4
5
|
src: string;
|
|
5
6
|
timeInSeconds: number;
|
|
@@ -13,6 +14,7 @@ type ExtractAudioParams = {
|
|
|
13
14
|
fps: number;
|
|
14
15
|
maxCacheSize: number;
|
|
15
16
|
credentials: RequestCredentials | undefined;
|
|
17
|
+
requestInit?: MediaRequestInit;
|
|
16
18
|
};
|
|
17
19
|
export declare const extractAudio: (params: ExtractAudioParams) => Promise<"cannot-decode" | "network-error" | "unknown-container-format" | {
|
|
18
20
|
data: PcmS16AudioData | null;
|
|
@@ -4,7 +4,7 @@ import type { DelayPlaybackIfNotPremounting } from './delay-playback-if-not-prem
|
|
|
4
4
|
import type { BufferWithMediaTimestamp } from './make-iterator-with-priming';
|
|
5
5
|
import type { Nonce } from './nonce-manager';
|
|
6
6
|
import type { SharedAudioContextForMediaPlayer } from './shared-audio-context-for-media-player';
|
|
7
|
-
type ScheduleAudioNode = (node: AudioBufferSourceNode, mediaTimestamp: number, originalUnloopedMediaTimestamp: number
|
|
7
|
+
type ScheduleAudioNode = (node: AudioBufferSourceNode, mediaTimestamp: number, originalUnloopedMediaTimestamp: number) => ScheduleAudioNodeResult;
|
|
8
8
|
export declare const audioIteratorManager: ({ audioTrack, delayPlaybackHandleIfNotPremounting, sharedAudioContext, getSequenceEndTimestamp, getSequenceDurationInSeconds, getMediaEndTimestamp, getStartTime, initialMuted, drawDebugOverlay, initialPlaybackRate, initialTrimBefore, initialTrimAfter, initialSequenceOffset, initialSequenceDurationInFrames, initialLoop, initialFps, }: {
|
|
9
9
|
audioTrack: InputAudioTrack;
|
|
10
10
|
delayPlaybackHandleIfNotPremounting: () => DelayPlaybackIfNotPremounting;
|
|
@@ -71,14 +71,13 @@ export declare const audioIteratorManager: ({ audioTrack, delayPlaybackHandleIfN
|
|
|
71
71
|
getTotalAudioScheduledInSeconds: () => number;
|
|
72
72
|
setMuted: (newMuted: boolean) => void;
|
|
73
73
|
setVolume: (volume: number) => void;
|
|
74
|
-
scheduleAudioChunk: ({ buffer, mediaTimestamp, originalUnloopedMediaTimestamp, playbackRate, scheduleAudioNode, logLevel,
|
|
74
|
+
scheduleAudioChunk: ({ buffer, mediaTimestamp, originalUnloopedMediaTimestamp, playbackRate, scheduleAudioNode, logLevel, }: {
|
|
75
75
|
buffer: AudioBuffer;
|
|
76
76
|
mediaTimestamp: number;
|
|
77
77
|
playbackRate: number;
|
|
78
78
|
scheduleAudioNode: ScheduleAudioNode;
|
|
79
79
|
logLevel: "error" | "info" | "trace" | "verbose" | "warn";
|
|
80
80
|
originalUnloopedMediaTimestamp: number;
|
|
81
|
-
currentTime: number;
|
|
82
81
|
}) => void;
|
|
83
82
|
waitForNScheduledNodes: (n: number) => Promise<void>;
|
|
84
83
|
};
|
|
@@ -11,7 +11,7 @@ export declare const drawPreviewOverlay: ({ context, audioTime, audioContextStat
|
|
|
11
11
|
startFromSecond: number;
|
|
12
12
|
nonce: import("../nonce-manager").Nonce;
|
|
13
13
|
playbackRate: number;
|
|
14
|
-
scheduleAudioNode: (node: AudioBufferSourceNode, mediaTimestamp: number, originalUnloopedMediaTimestamp: number
|
|
14
|
+
scheduleAudioNode: (node: AudioBufferSourceNode, mediaTimestamp: number, originalUnloopedMediaTimestamp: number) => import("remotion").ScheduleAudioNodeResult;
|
|
15
15
|
getTargetTime: (mediaTimestamp: number, currentTime: number) => number | null;
|
|
16
16
|
logLevel: "error" | "info" | "trace" | "verbose" | "warn";
|
|
17
17
|
loop: boolean;
|
|
@@ -40,7 +40,7 @@ export declare const drawPreviewOverlay: ({ context, audioTime, audioContextStat
|
|
|
40
40
|
newTime: number;
|
|
41
41
|
nonce: import("../nonce-manager").Nonce;
|
|
42
42
|
playbackRate: number;
|
|
43
|
-
scheduleAudioNode: (node: AudioBufferSourceNode, mediaTimestamp: number, originalUnloopedMediaTimestamp: number
|
|
43
|
+
scheduleAudioNode: (node: AudioBufferSourceNode, mediaTimestamp: number, originalUnloopedMediaTimestamp: number) => import("remotion").ScheduleAudioNodeResult;
|
|
44
44
|
getTargetTime: (mediaTimestamp: number, currentTime: number) => number | null;
|
|
45
45
|
logLevel: "error" | "info" | "trace" | "verbose" | "warn";
|
|
46
46
|
loop: boolean;
|
|
@@ -55,14 +55,13 @@ export declare const drawPreviewOverlay: ({ context, audioTime, audioContextStat
|
|
|
55
55
|
getTotalAudioScheduledInSeconds: () => number;
|
|
56
56
|
setMuted: (newMuted: boolean) => void;
|
|
57
57
|
setVolume: (volume: number) => void;
|
|
58
|
-
scheduleAudioChunk: ({ buffer, mediaTimestamp, originalUnloopedMediaTimestamp, playbackRate, scheduleAudioNode, logLevel,
|
|
58
|
+
scheduleAudioChunk: ({ buffer, mediaTimestamp, originalUnloopedMediaTimestamp, playbackRate, scheduleAudioNode, logLevel, }: {
|
|
59
59
|
buffer: AudioBuffer;
|
|
60
60
|
mediaTimestamp: number;
|
|
61
61
|
playbackRate: number;
|
|
62
|
-
scheduleAudioNode: (node: AudioBufferSourceNode, mediaTimestamp: number, originalUnloopedMediaTimestamp: number
|
|
62
|
+
scheduleAudioNode: (node: AudioBufferSourceNode, mediaTimestamp: number, originalUnloopedMediaTimestamp: number) => import("remotion").ScheduleAudioNodeResult;
|
|
63
63
|
logLevel: "error" | "info" | "trace" | "verbose" | "warn";
|
|
64
64
|
originalUnloopedMediaTimestamp: number;
|
|
65
|
-
currentTime: number;
|
|
66
65
|
}) => void;
|
|
67
66
|
waitForNScheduledNodes: (n: number) => Promise<void>;
|
|
68
67
|
} | null;
|
package/dist/esm/index.mjs
CHANGED
|
@@ -324,16 +324,16 @@ var getDurationOfNode = ({
|
|
|
324
324
|
const duration = needsTrimEnd ? durationMinusOffset - Math.max(0, originalUnloopedMediaEndTime - loopSegmentMediaEndTimestamp) : durationMinusOffset;
|
|
325
325
|
return duration;
|
|
326
326
|
};
|
|
327
|
-
var
|
|
327
|
+
var getTrimStartForAudioNode = ({
|
|
328
328
|
mediaTimestamp,
|
|
329
329
|
targetTime,
|
|
330
|
-
sequenceStartTime
|
|
330
|
+
sequenceStartTime,
|
|
331
|
+
combinedPlaybackRate
|
|
331
332
|
}) => {
|
|
332
333
|
const needsTrimStart = mediaTimestamp < sequenceStartTime;
|
|
333
334
|
const offsetBecauseOfTrim = needsTrimStart ? sequenceStartTime - mediaTimestamp : 0;
|
|
334
|
-
const offsetBecauseOfTooLate = targetTime < 0 ? -targetTime : 0;
|
|
335
|
-
|
|
336
|
-
return offset;
|
|
335
|
+
const offsetBecauseOfTooLate = targetTime < 0 ? -targetTime * combinedPlaybackRate : 0;
|
|
336
|
+
return offsetBecauseOfTrim + offsetBecauseOfTooLate;
|
|
337
337
|
};
|
|
338
338
|
|
|
339
339
|
// src/audio/sort-by-priority.ts
|
|
@@ -475,8 +475,7 @@ var audioIteratorManager = ({
|
|
|
475
475
|
originalUnloopedMediaTimestamp,
|
|
476
476
|
playbackRate,
|
|
477
477
|
scheduleAudioNode,
|
|
478
|
-
logLevel
|
|
479
|
-
currentTime
|
|
478
|
+
logLevel
|
|
480
479
|
}) => {
|
|
481
480
|
if (!audioBufferIterator) {
|
|
482
481
|
throw new Error("Audio buffer iterator not found");
|
|
@@ -488,7 +487,7 @@ var audioIteratorManager = ({
|
|
|
488
487
|
node.buffer = buffer;
|
|
489
488
|
node.playbackRate.value = playbackRate;
|
|
490
489
|
node.connect(gainNode);
|
|
491
|
-
const started = scheduleAudioNode(node, mediaTimestamp, originalUnloopedMediaTimestamp
|
|
490
|
+
const started = scheduleAudioNode(node, mediaTimestamp, originalUnloopedMediaTimestamp);
|
|
492
491
|
if (started.type === "not-started") {
|
|
493
492
|
Internals3.Log.verbose({ logLevel, tag: "audio-scheduling" }, "not started, disconnected: %s %s", mediaTimestamp.toFixed(3), buffer.duration.toFixed(3));
|
|
494
493
|
node.disconnect();
|
|
@@ -506,8 +505,7 @@ var audioIteratorManager = ({
|
|
|
506
505
|
buffer,
|
|
507
506
|
playbackRate,
|
|
508
507
|
scheduleAudioNode,
|
|
509
|
-
logLevel
|
|
510
|
-
currentTime
|
|
508
|
+
logLevel
|
|
511
509
|
}) => {
|
|
512
510
|
if (muted) {
|
|
513
511
|
return;
|
|
@@ -529,8 +527,7 @@ var audioIteratorManager = ({
|
|
|
529
527
|
playbackRate,
|
|
530
528
|
scheduleAudioNode,
|
|
531
529
|
logLevel,
|
|
532
|
-
originalUnloopedMediaTimestamp: buffer.buffer.timestamp
|
|
533
|
-
currentTime
|
|
530
|
+
originalUnloopedMediaTimestamp: buffer.buffer.timestamp
|
|
534
531
|
});
|
|
535
532
|
drawDebugOverlay();
|
|
536
533
|
};
|
|
@@ -583,8 +580,7 @@ var audioIteratorManager = ({
|
|
|
583
580
|
buffer: result.value,
|
|
584
581
|
playbackRate,
|
|
585
582
|
scheduleAudioNode,
|
|
586
|
-
logLevel
|
|
587
|
-
currentTime
|
|
583
|
+
logLevel
|
|
588
584
|
});
|
|
589
585
|
proceedScheduling({
|
|
590
586
|
iterator,
|
|
@@ -931,6 +927,74 @@ class PremountAwareDelayPlayback {
|
|
|
931
927
|
}
|
|
932
928
|
}
|
|
933
929
|
|
|
930
|
+
// src/request-init.ts
|
|
931
|
+
var normalizeMediaHeaders = (headers) => {
|
|
932
|
+
if (!headers) {
|
|
933
|
+
return;
|
|
934
|
+
}
|
|
935
|
+
const entries = [];
|
|
936
|
+
if (headers instanceof Headers) {
|
|
937
|
+
headers.forEach((value, key) => {
|
|
938
|
+
entries.push([key.toLowerCase(), value]);
|
|
939
|
+
});
|
|
940
|
+
} else if (Array.isArray(headers)) {
|
|
941
|
+
for (const [key, value] of headers) {
|
|
942
|
+
entries.push([key.toLowerCase(), value]);
|
|
943
|
+
}
|
|
944
|
+
} else {
|
|
945
|
+
for (const [key, value] of Object.entries(headers)) {
|
|
946
|
+
entries.push([key.toLowerCase(), value]);
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
entries.sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
|
|
950
|
+
return entries;
|
|
951
|
+
};
|
|
952
|
+
var normalizeMediaRequestInit = (requestInit) => {
|
|
953
|
+
if (!requestInit) {
|
|
954
|
+
return;
|
|
955
|
+
}
|
|
956
|
+
const headers = normalizeMediaHeaders(requestInit.headers);
|
|
957
|
+
const normalized = {
|
|
958
|
+
...requestInit.cache === undefined ? null : { cache: requestInit.cache },
|
|
959
|
+
...requestInit.credentials === undefined ? null : { credentials: requestInit.credentials },
|
|
960
|
+
...headers === undefined ? null : { headers },
|
|
961
|
+
...requestInit.integrity === undefined ? null : { integrity: requestInit.integrity },
|
|
962
|
+
...requestInit.mode === undefined ? null : { mode: requestInit.mode },
|
|
963
|
+
...requestInit.redirect === undefined ? null : { redirect: requestInit.redirect },
|
|
964
|
+
...requestInit.referrer === undefined ? null : { referrer: requestInit.referrer },
|
|
965
|
+
...requestInit.referrerPolicy === undefined ? null : { referrerPolicy: requestInit.referrerPolicy }
|
|
966
|
+
};
|
|
967
|
+
return Object.keys(normalized).length === 0 ? undefined : normalized;
|
|
968
|
+
};
|
|
969
|
+
var getMediaRequestInitFingerprint = (requestInit) => {
|
|
970
|
+
const normalized = normalizeMediaRequestInit(requestInit);
|
|
971
|
+
if (!normalized) {
|
|
972
|
+
return null;
|
|
973
|
+
}
|
|
974
|
+
return [
|
|
975
|
+
normalized.cache ?? null,
|
|
976
|
+
normalized.credentials ?? null,
|
|
977
|
+
normalized.integrity ?? null,
|
|
978
|
+
normalized.mode ?? null,
|
|
979
|
+
normalized.redirect ?? null,
|
|
980
|
+
normalized.referrer ?? null,
|
|
981
|
+
normalized.referrerPolicy ?? null,
|
|
982
|
+
normalized.headers ?? null
|
|
983
|
+
];
|
|
984
|
+
};
|
|
985
|
+
var resolveRequestInit = ({
|
|
986
|
+
credentials,
|
|
987
|
+
requestInit
|
|
988
|
+
}) => {
|
|
989
|
+
if (credentials === undefined) {
|
|
990
|
+
return normalizeMediaRequestInit(requestInit);
|
|
991
|
+
}
|
|
992
|
+
return normalizeMediaRequestInit({
|
|
993
|
+
credentials,
|
|
994
|
+
...requestInit
|
|
995
|
+
});
|
|
996
|
+
};
|
|
997
|
+
|
|
934
998
|
// src/video-iterator-manager.ts
|
|
935
999
|
import { CanvasSink } from "mediabunny";
|
|
936
1000
|
import { Internals as Internals4 } from "remotion";
|
|
@@ -1388,6 +1452,7 @@ class MediaPlayer {
|
|
|
1388
1452
|
playing,
|
|
1389
1453
|
sequenceOffset,
|
|
1390
1454
|
credentials,
|
|
1455
|
+
requestInit,
|
|
1391
1456
|
tagType,
|
|
1392
1457
|
getEffects,
|
|
1393
1458
|
getEffectChainState
|
|
@@ -1414,9 +1479,10 @@ class MediaPlayer {
|
|
|
1414
1479
|
this.onVideoFrameCallback = onVideoFrameCallback;
|
|
1415
1480
|
this.playing = playing;
|
|
1416
1481
|
this.sequenceOffset = sequenceOffset;
|
|
1482
|
+
const resolvedRequestInit = resolveRequestInit({ credentials, requestInit });
|
|
1417
1483
|
this.input = new Input({
|
|
1418
|
-
source: new UrlSource(this.src,
|
|
1419
|
-
requestInit:
|
|
1484
|
+
source: new UrlSource(this.src, resolvedRequestInit ? {
|
|
1485
|
+
requestInit: resolvedRequestInit
|
|
1420
1486
|
} : undefined),
|
|
1421
1487
|
formats: ALL_FORMATS
|
|
1422
1488
|
});
|
|
@@ -1789,23 +1855,25 @@ class MediaPlayer {
|
|
|
1789
1855
|
const targetTime = (mediaTimestamp - localTime) / (this.playbackRate * this.globalPlaybackRate);
|
|
1790
1856
|
return targetTime;
|
|
1791
1857
|
};
|
|
1792
|
-
scheduleAudioNode = (node, mediaTimestamp, originalUnloopedMediaTimestamp
|
|
1858
|
+
scheduleAudioNode = (node, mediaTimestamp, originalUnloopedMediaTimestamp) => {
|
|
1793
1859
|
if (!this.sharedAudioContext) {
|
|
1794
1860
|
throw new Error("Shared audio context not found");
|
|
1795
1861
|
}
|
|
1796
|
-
const targetTime = this.getTargetTime(mediaTimestamp, currentTime);
|
|
1862
|
+
const targetTime = this.getTargetTime(mediaTimestamp, this.sharedAudioContext.audioContext.currentTime);
|
|
1863
|
+
const combinedPlaybackRate = this.playbackRate * this.globalPlaybackRate;
|
|
1797
1864
|
if (targetTime === null) {
|
|
1798
1865
|
return {
|
|
1799
1866
|
type: "not-started",
|
|
1800
|
-
reason: "no target for" + mediaTimestamp.toFixed(3) + "," + currentTime.toFixed(3)
|
|
1867
|
+
reason: "no target for" + mediaTimestamp.toFixed(3) + "," + this.sharedAudioContext.audioContext.currentTime.toFixed(3)
|
|
1801
1868
|
};
|
|
1802
1869
|
}
|
|
1803
1870
|
const sequenceStartTime = this.getStartTime();
|
|
1804
1871
|
const loopSegmentMediaEndTimestamp = this.getLoopSegmentMediaEndTimestamp();
|
|
1805
|
-
const offset =
|
|
1872
|
+
const offset = getTrimStartForAudioNode({
|
|
1806
1873
|
mediaTimestamp,
|
|
1807
1874
|
targetTime,
|
|
1808
|
-
sequenceStartTime
|
|
1875
|
+
sequenceStartTime,
|
|
1876
|
+
combinedPlaybackRate
|
|
1809
1877
|
});
|
|
1810
1878
|
const duration = getDurationOfNode({
|
|
1811
1879
|
bufferDuration: node.buffer?.duration ?? 0,
|
|
@@ -1816,13 +1884,12 @@ class MediaPlayer {
|
|
|
1816
1884
|
const scheduledTime = getScheduledTime({
|
|
1817
1885
|
mediaTimestamp,
|
|
1818
1886
|
targetTime,
|
|
1819
|
-
|
|
1820
|
-
|
|
1887
|
+
sequenceStartTime,
|
|
1888
|
+
currentTime: this.sharedAudioContext.audioContext.currentTime
|
|
1821
1889
|
});
|
|
1822
1890
|
return this.sharedAudioContext.scheduleAudioNode({
|
|
1823
1891
|
node,
|
|
1824
1892
|
mediaTimestamp,
|
|
1825
|
-
currentTime,
|
|
1826
1893
|
scheduledTime,
|
|
1827
1894
|
duration,
|
|
1828
1895
|
offset,
|
|
@@ -2061,6 +2128,7 @@ var AudioForPreviewAssertedShowing = ({
|
|
|
2061
2128
|
fallbackHtml5AudioProps,
|
|
2062
2129
|
onError,
|
|
2063
2130
|
credentials,
|
|
2131
|
+
requestInit,
|
|
2064
2132
|
setMediaDurationInSeconds
|
|
2065
2133
|
}) => {
|
|
2066
2134
|
const videoConfig = useUnsafeVideoConfig();
|
|
@@ -2068,6 +2136,7 @@ var AudioForPreviewAssertedShowing = ({
|
|
|
2068
2136
|
const mediaPlayerRef = useRef(null);
|
|
2069
2137
|
const initialTrimBeforeRef = useRef(trimBefore);
|
|
2070
2138
|
const initialTrimAfterRef = useRef(trimAfter);
|
|
2139
|
+
const [initialRequestInit] = useState(requestInit);
|
|
2071
2140
|
const [mediaPlayerReady, setMediaPlayerReady] = useState(false);
|
|
2072
2141
|
const [shouldFallbackToNativeAudio, setShouldFallbackToNativeAudio] = useState(false);
|
|
2073
2142
|
const [playing] = Timeline.usePlayingState();
|
|
@@ -2177,6 +2246,7 @@ var AudioForPreviewAssertedShowing = ({
|
|
|
2177
2246
|
playing: initialPlaying.current,
|
|
2178
2247
|
sequenceOffset: initialSequenceOffset.current,
|
|
2179
2248
|
credentials,
|
|
2249
|
+
requestInit: initialRequestInit,
|
|
2180
2250
|
tagType: "audio",
|
|
2181
2251
|
getEffects: () => [],
|
|
2182
2252
|
getEffectChainState: () => null
|
|
@@ -2271,6 +2341,7 @@ var AudioForPreviewAssertedShowing = ({
|
|
|
2271
2341
|
buffer,
|
|
2272
2342
|
onError,
|
|
2273
2343
|
credentials,
|
|
2344
|
+
initialRequestInit,
|
|
2274
2345
|
setMediaDurationInSeconds
|
|
2275
2346
|
]);
|
|
2276
2347
|
if (shouldFallbackToNativeAudio && !disallowFallbackToHtml5Audio) {
|
|
@@ -2314,6 +2385,7 @@ var AudioForPreview = ({
|
|
|
2314
2385
|
fallbackHtml5AudioProps,
|
|
2315
2386
|
onError,
|
|
2316
2387
|
credentials,
|
|
2388
|
+
requestInit,
|
|
2317
2389
|
setMediaDurationInSeconds
|
|
2318
2390
|
}) => {
|
|
2319
2391
|
const preloadedSrc = usePreload(src);
|
|
@@ -2366,6 +2438,7 @@ var AudioForPreview = ({
|
|
|
2366
2438
|
toneFrequency,
|
|
2367
2439
|
onError,
|
|
2368
2440
|
credentials,
|
|
2441
|
+
requestInit,
|
|
2369
2442
|
fallbackHtml5AudioProps,
|
|
2370
2443
|
setMediaDurationInSeconds
|
|
2371
2444
|
});
|
|
@@ -3540,12 +3613,13 @@ var getFormatOrNullOrNetworkError = async (input) => {
|
|
|
3540
3613
|
return null;
|
|
3541
3614
|
}
|
|
3542
3615
|
};
|
|
3543
|
-
var getSinks = async (src, credentials) => {
|
|
3616
|
+
var getSinks = async (src, credentials, requestInit) => {
|
|
3617
|
+
const resolvedRequestInit = resolveRequestInit({ credentials, requestInit });
|
|
3544
3618
|
const input = new Input2({
|
|
3545
3619
|
formats: ALL_FORMATS2,
|
|
3546
3620
|
source: new UrlSource2(src, {
|
|
3547
3621
|
getRetryDelay,
|
|
3548
|
-
...
|
|
3622
|
+
...resolvedRequestInit ? { requestInit: resolvedRequestInit } : undefined
|
|
3549
3623
|
})
|
|
3550
3624
|
});
|
|
3551
3625
|
const format = await getFormatOrNullOrNetworkError(input);
|
|
@@ -3641,15 +3715,29 @@ var getSinks = async (src, credentials) => {
|
|
|
3641
3715
|
|
|
3642
3716
|
// src/get-sink.ts
|
|
3643
3717
|
var sinkPromises = {};
|
|
3644
|
-
var
|
|
3645
|
-
|
|
3718
|
+
var getSinkCacheKey = ({
|
|
3719
|
+
src,
|
|
3720
|
+
credentials,
|
|
3721
|
+
requestInit
|
|
3722
|
+
}) => JSON.stringify([
|
|
3723
|
+
src,
|
|
3724
|
+
credentials,
|
|
3725
|
+
getMediaRequestInitFingerprint(requestInit)
|
|
3726
|
+
]);
|
|
3727
|
+
var getSink = (src, logLevel, credentials, requestInit) => {
|
|
3728
|
+
const normalizedRequestInit = normalizeMediaRequestInit(requestInit);
|
|
3729
|
+
const cacheKey = getSinkCacheKey({
|
|
3730
|
+
src,
|
|
3731
|
+
credentials,
|
|
3732
|
+
requestInit: normalizedRequestInit
|
|
3733
|
+
});
|
|
3646
3734
|
let promise = sinkPromises[cacheKey];
|
|
3647
3735
|
if (!promise) {
|
|
3648
3736
|
Internals13.Log.verbose({
|
|
3649
3737
|
logLevel,
|
|
3650
3738
|
tag: "@remotion/media"
|
|
3651
3739
|
}, `Sink for ${src} was not found, creating new sink`);
|
|
3652
|
-
promise = getSinks(src, credentials);
|
|
3740
|
+
promise = getSinks(src, credentials, normalizedRequestInit);
|
|
3653
3741
|
sinkPromises[cacheKey] = promise;
|
|
3654
3742
|
}
|
|
3655
3743
|
return promise;
|
|
@@ -3668,9 +3756,10 @@ var extractAudioInternal = async ({
|
|
|
3668
3756
|
trimAfter,
|
|
3669
3757
|
fps,
|
|
3670
3758
|
maxCacheSize,
|
|
3671
|
-
credentials
|
|
3759
|
+
credentials,
|
|
3760
|
+
requestInit
|
|
3672
3761
|
}) => {
|
|
3673
|
-
const { getAudio, actualMatroskaTimestamps, isMatroska, getDuration } = await getSink(src, logLevel, credentials);
|
|
3762
|
+
const { getAudio, actualMatroskaTimestamps, isMatroska, getDuration } = await getSink(src, logLevel, credentials, requestInit);
|
|
3674
3763
|
let mediaDurationInSeconds = null;
|
|
3675
3764
|
if (loop) {
|
|
3676
3765
|
mediaDurationInSeconds = await getDuration();
|
|
@@ -3797,9 +3886,10 @@ var extractFrameInternal = async ({
|
|
|
3797
3886
|
playbackRate,
|
|
3798
3887
|
fps,
|
|
3799
3888
|
maxCacheSize,
|
|
3800
|
-
credentials
|
|
3889
|
+
credentials,
|
|
3890
|
+
requestInit
|
|
3801
3891
|
}) => {
|
|
3802
|
-
const sink = await getSink(src, logLevel, credentials);
|
|
3892
|
+
const sink = await getSink(src, logLevel, credentials, requestInit);
|
|
3803
3893
|
const [video, mediaDurationInSecondsRaw] = await Promise.all([
|
|
3804
3894
|
sink.getVideo(),
|
|
3805
3895
|
loop ? sink.getDuration() : Promise.resolve(null)
|
|
@@ -3926,7 +4016,8 @@ var extractFrameAndAudio = async ({
|
|
|
3926
4016
|
trimBefore,
|
|
3927
4017
|
fps,
|
|
3928
4018
|
maxCacheSize,
|
|
3929
|
-
credentials
|
|
4019
|
+
credentials,
|
|
4020
|
+
requestInit
|
|
3930
4021
|
}) => {
|
|
3931
4022
|
try {
|
|
3932
4023
|
const [video, audio] = await Promise.all([
|
|
@@ -3940,7 +4031,8 @@ var extractFrameAndAudio = async ({
|
|
|
3940
4031
|
trimBefore,
|
|
3941
4032
|
fps,
|
|
3942
4033
|
maxCacheSize,
|
|
3943
|
-
credentials
|
|
4034
|
+
credentials,
|
|
4035
|
+
requestInit
|
|
3944
4036
|
}) : null,
|
|
3945
4037
|
includeAudio ? extractAudio({
|
|
3946
4038
|
src,
|
|
@@ -3954,7 +4046,8 @@ var extractFrameAndAudio = async ({
|
|
|
3954
4046
|
fps,
|
|
3955
4047
|
trimBefore,
|
|
3956
4048
|
maxCacheSize,
|
|
3957
|
-
credentials
|
|
4049
|
+
credentials,
|
|
4050
|
+
requestInit
|
|
3958
4051
|
}) : null
|
|
3959
4052
|
]);
|
|
3960
4053
|
if (video?.type === "cannot-decode") {
|
|
@@ -4038,7 +4131,8 @@ var addBroadcastChannelListener = () => {
|
|
|
4038
4131
|
trimBefore: data.trimBefore,
|
|
4039
4132
|
fps: data.fps,
|
|
4040
4133
|
maxCacheSize: data.maxCacheSize,
|
|
4041
|
-
credentials: data.credentials
|
|
4134
|
+
credentials: data.credentials,
|
|
4135
|
+
requestInit: data.requestInit
|
|
4042
4136
|
});
|
|
4043
4137
|
if (result.type === "cannot-decode") {
|
|
4044
4138
|
const cannotDecodeResponse = {
|
|
@@ -4136,7 +4230,8 @@ var extractFrameViaBroadcastChannel = async ({
|
|
|
4136
4230
|
trimBefore,
|
|
4137
4231
|
fps,
|
|
4138
4232
|
maxCacheSize,
|
|
4139
|
-
credentials
|
|
4233
|
+
credentials,
|
|
4234
|
+
requestInit
|
|
4140
4235
|
}) => {
|
|
4141
4236
|
if (isClientSideRendering || window.remotion_isMainTab) {
|
|
4142
4237
|
return extractFrameAndAudio({
|
|
@@ -4153,7 +4248,8 @@ var extractFrameViaBroadcastChannel = async ({
|
|
|
4153
4248
|
trimBefore,
|
|
4154
4249
|
fps,
|
|
4155
4250
|
maxCacheSize,
|
|
4156
|
-
credentials
|
|
4251
|
+
credentials,
|
|
4252
|
+
requestInit
|
|
4157
4253
|
});
|
|
4158
4254
|
}
|
|
4159
4255
|
await waitForMainTabToBeReady(window.remotion_broadcastChannel);
|
|
@@ -4231,7 +4327,8 @@ var extractFrameViaBroadcastChannel = async ({
|
|
|
4231
4327
|
trimBefore,
|
|
4232
4328
|
fps,
|
|
4233
4329
|
maxCacheSize,
|
|
4234
|
-
credentials
|
|
4330
|
+
credentials,
|
|
4331
|
+
requestInit: normalizeMediaRequestInit(requestInit)
|
|
4235
4332
|
};
|
|
4236
4333
|
window.remotion_broadcastChannel.postMessage(request);
|
|
4237
4334
|
let timeoutId;
|
|
@@ -4270,7 +4367,8 @@ var AudioForRendering = ({
|
|
|
4270
4367
|
trimAfter,
|
|
4271
4368
|
trimBefore,
|
|
4272
4369
|
onError,
|
|
4273
|
-
credentials
|
|
4370
|
+
credentials,
|
|
4371
|
+
requestInit
|
|
4274
4372
|
}) => {
|
|
4275
4373
|
const defaultLogLevel = Internals15.useLogLevel();
|
|
4276
4374
|
const logLevel = overriddenLogLevel ?? defaultLogLevel;
|
|
@@ -4289,6 +4387,7 @@ var AudioForRendering = ({
|
|
|
4289
4387
|
const { fps } = videoConfig;
|
|
4290
4388
|
const { delayRender, continueRender } = useDelayRender();
|
|
4291
4389
|
const [replaceWithHtml5Audio, setReplaceWithHtml5Audio] = useState2(false);
|
|
4390
|
+
const [initialRequestInit] = useState2(requestInit);
|
|
4292
4391
|
const sequenceContext = useContext3(Internals15.SequenceContext);
|
|
4293
4392
|
const id = useMemo2(() => `media-audio-${random(src)}-${sequenceContext?.cumulatedFrom}-${sequenceContext?.relativeFrom}-${sequenceContext?.durationInFrames}`, [
|
|
4294
4393
|
src,
|
|
@@ -4335,7 +4434,8 @@ var AudioForRendering = ({
|
|
|
4335
4434
|
trimBefore,
|
|
4336
4435
|
fps,
|
|
4337
4436
|
maxCacheSize,
|
|
4338
|
-
credentials
|
|
4437
|
+
credentials,
|
|
4438
|
+
requestInit: initialRequestInit
|
|
4339
4439
|
}).then((result) => {
|
|
4340
4440
|
const handleError = (error, clientSideError, fallbackMessage) => {
|
|
4341
4441
|
const [action, errorToUse] = callOnErrorAndResolve({
|
|
@@ -4430,7 +4530,8 @@ var AudioForRendering = ({
|
|
|
4430
4530
|
maxCacheSize,
|
|
4431
4531
|
audioEnabled,
|
|
4432
4532
|
onError,
|
|
4433
|
-
credentials
|
|
4533
|
+
credentials,
|
|
4534
|
+
initialRequestInit
|
|
4434
4535
|
]);
|
|
4435
4536
|
if (replaceWithHtml5Audio) {
|
|
4436
4537
|
return /* @__PURE__ */ jsx2(Html5Audio, {
|
|
@@ -4665,6 +4766,7 @@ var VideoForPreviewAssertedShowing = ({
|
|
|
4665
4766
|
headless,
|
|
4666
4767
|
onError,
|
|
4667
4768
|
credentials,
|
|
4769
|
+
requestInit,
|
|
4668
4770
|
objectFit: objectFitProp,
|
|
4669
4771
|
_experimentalInitiallyDrawCachedFrame,
|
|
4670
4772
|
effects,
|
|
@@ -4678,6 +4780,7 @@ var VideoForPreviewAssertedShowing = ({
|
|
|
4678
4780
|
const initialTrimBeforeRef = useRef2(trimBefore);
|
|
4679
4781
|
const initialTrimAfterRef = useRef2(trimAfter);
|
|
4680
4782
|
const initialOnVideoFrameRef = useRef2(onVideoFrame);
|
|
4783
|
+
const [initialRequestInit] = useState4(requestInit);
|
|
4681
4784
|
const [mediaPlayerReady, setMediaPlayerReady] = useState4(false);
|
|
4682
4785
|
const [shouldFallbackToNativeVideo, setShouldFallbackToNativeVideo] = useState4(false);
|
|
4683
4786
|
const [playing] = Timeline2.usePlayingState();
|
|
@@ -4804,6 +4907,7 @@ var VideoForPreviewAssertedShowing = ({
|
|
|
4804
4907
|
playing: initialPlaying.current,
|
|
4805
4908
|
sequenceOffset: initialSequenceOffset.current,
|
|
4806
4909
|
credentials,
|
|
4910
|
+
requestInit: initialRequestInit,
|
|
4807
4911
|
tagType: "video",
|
|
4808
4912
|
getEffects: () => effectsRef.current,
|
|
4809
4913
|
getEffectChainState: (width, height) => effectChainStateRef.current?.get(width, height)
|
|
@@ -4898,6 +5002,7 @@ var VideoForPreviewAssertedShowing = ({
|
|
|
4898
5002
|
videoConfig.fps,
|
|
4899
5003
|
onError,
|
|
4900
5004
|
credentials,
|
|
5005
|
+
initialRequestInit,
|
|
4901
5006
|
setMediaDurationInSeconds
|
|
4902
5007
|
]);
|
|
4903
5008
|
warnAboutObjectFitInStyleOrClassName({ style, className, logLevel });
|
|
@@ -5055,6 +5160,7 @@ var VideoForRendering = ({
|
|
|
5055
5160
|
headless,
|
|
5056
5161
|
onError,
|
|
5057
5162
|
credentials,
|
|
5163
|
+
requestInit,
|
|
5058
5164
|
objectFit: objectFitProp
|
|
5059
5165
|
}) => {
|
|
5060
5166
|
if (!src) {
|
|
@@ -5076,6 +5182,7 @@ var VideoForRendering = ({
|
|
|
5076
5182
|
const { delayRender, continueRender, cancelRender: cancelRender3 } = useDelayRender2();
|
|
5077
5183
|
const canvasRef = useRef3(null);
|
|
5078
5184
|
const [replaceWithOffthreadVideo, setReplaceWithOffthreadVideo] = useState5(false);
|
|
5185
|
+
const [initialRequestInit] = useState5(requestInit);
|
|
5079
5186
|
const audioEnabled = Internals19.useAudioEnabled();
|
|
5080
5187
|
const videoEnabled = Internals19.useVideoEnabled();
|
|
5081
5188
|
const maxCacheSize = useMaxMediaCacheSize(logLevel);
|
|
@@ -5123,7 +5230,8 @@ var VideoForRendering = ({
|
|
|
5123
5230
|
trimBefore: trimBeforeValue,
|
|
5124
5231
|
fps,
|
|
5125
5232
|
maxCacheSize,
|
|
5126
|
-
credentials
|
|
5233
|
+
credentials,
|
|
5234
|
+
requestInit: initialRequestInit
|
|
5127
5235
|
}).then((result) => {
|
|
5128
5236
|
const handleError = (err, clientSideError, fallbackMessage, mediaDurationInSeconds) => {
|
|
5129
5237
|
if (environment.isClientSideRendering) {
|
|
@@ -5256,7 +5364,8 @@ var VideoForRendering = ({
|
|
|
5256
5364
|
cancelRender3,
|
|
5257
5365
|
headless,
|
|
5258
5366
|
onError,
|
|
5259
|
-
credentials
|
|
5367
|
+
credentials,
|
|
5368
|
+
initialRequestInit
|
|
5260
5369
|
]);
|
|
5261
5370
|
warnAboutObjectFitInStyleOrClassName({ style, className, logLevel });
|
|
5262
5371
|
const classNameValue = useMemo5(() => {
|
|
@@ -5383,6 +5492,7 @@ var InnerVideo = ({
|
|
|
5383
5492
|
headless,
|
|
5384
5493
|
onError,
|
|
5385
5494
|
credentials,
|
|
5495
|
+
requestInit,
|
|
5386
5496
|
_experimentalControls: controls,
|
|
5387
5497
|
objectFit,
|
|
5388
5498
|
_experimentalInitiallyDrawCachedFrame,
|
|
@@ -5430,6 +5540,7 @@ var InnerVideo = ({
|
|
|
5430
5540
|
headless,
|
|
5431
5541
|
onError,
|
|
5432
5542
|
credentials,
|
|
5543
|
+
requestInit,
|
|
5433
5544
|
objectFit
|
|
5434
5545
|
});
|
|
5435
5546
|
}
|
|
@@ -5456,6 +5567,7 @@ var InnerVideo = ({
|
|
|
5456
5567
|
headless: headless ?? false,
|
|
5457
5568
|
onError,
|
|
5458
5569
|
credentials,
|
|
5570
|
+
requestInit,
|
|
5459
5571
|
controls,
|
|
5460
5572
|
objectFit,
|
|
5461
5573
|
effects,
|
|
@@ -5488,6 +5600,7 @@ var VideoInner = ({
|
|
|
5488
5600
|
headless,
|
|
5489
5601
|
onError,
|
|
5490
5602
|
credentials,
|
|
5603
|
+
requestInit,
|
|
5491
5604
|
_experimentalControls: controls,
|
|
5492
5605
|
objectFit,
|
|
5493
5606
|
_experimentalInitiallyDrawCachedFrame,
|
|
@@ -5582,6 +5695,7 @@ var VideoInner = ({
|
|
|
5582
5695
|
headless: headless ?? false,
|
|
5583
5696
|
onError,
|
|
5584
5697
|
credentials,
|
|
5698
|
+
requestInit,
|
|
5585
5699
|
_experimentalControls: controls,
|
|
5586
5700
|
objectFit: objectFit ?? "contain",
|
|
5587
5701
|
_experimentalInitiallyDrawCachedFrame: _experimentalInitiallyDrawCachedFrame ?? false,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import type { MediaRequestInit } from './request-init';
|
|
1
2
|
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, credentials, }: {
|
|
3
|
+
export declare const extractFrameAndAudio: ({ src, timeInSeconds, logLevel, durationInSeconds, playbackRate, includeAudio, includeVideo, loop, audioStreamIndex, trimAfter, trimBefore, fps, maxCacheSize, credentials, requestInit, }: {
|
|
3
4
|
src: string;
|
|
4
5
|
timeInSeconds: number;
|
|
5
6
|
logLevel: "error" | "info" | "trace" | "verbose" | "warn";
|
|
@@ -14,4 +15,5 @@ export declare const extractFrameAndAudio: ({ src, timeInSeconds, logLevel, dura
|
|
|
14
15
|
fps: number;
|
|
15
16
|
maxCacheSize: number;
|
|
16
17
|
credentials: RequestCredentials | undefined;
|
|
18
|
+
requestInit?: MediaRequestInit | undefined;
|
|
17
19
|
}) => Promise<ExtractFrameViaBroadcastChannelResult>;
|
package/dist/get-sink.d.ts
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
|
+
import { type MediaRequestInit } from './request-init';
|
|
1
2
|
import type { GetSink } from './video-extraction/get-frames-since-keyframe';
|
|
2
3
|
export declare const sinkPromises: Record<string, Promise<GetSink>>;
|
|
3
|
-
export declare const
|
|
4
|
+
export declare const getSinkCacheKey: ({ src, credentials, requestInit, }: {
|
|
5
|
+
src: string;
|
|
6
|
+
credentials: RequestCredentials | undefined;
|
|
7
|
+
requestInit: MediaRequestInit | undefined;
|
|
8
|
+
}) => string;
|
|
9
|
+
export declare const getSink: (src: string, logLevel: "error" | "info" | "trace" | "verbose" | "warn", credentials: RequestCredentials | undefined, requestInit: MediaRequestInit | undefined) => Promise<{
|
|
4
10
|
getVideo: () => Promise<import("./video-extraction/get-frames-since-keyframe").VideoSinkResult>;
|
|
5
11
|
getAudio: (index: number | null) => Promise<import("./video-extraction/get-frames-since-keyframe").AudioSinkResult>;
|
|
6
12
|
actualMatroskaTimestamps: {
|
package/dist/index.d.ts
CHANGED
|
@@ -24,6 +24,7 @@ export declare const experimental_Audio: import("react").ComponentType<{
|
|
|
24
24
|
delayRenderTimeoutInMilliseconds?: number | undefined;
|
|
25
25
|
onError?: import("./on-error").MediaOnError | undefined;
|
|
26
26
|
credentials?: RequestCredentials | undefined;
|
|
27
|
+
requestInit?: import("./request-init").MediaRequestInit | undefined;
|
|
27
28
|
} & Pick<import("remotion").SequenceProps, "durationInFrames" | "from" | "hidden" | "name" | "showInTimeline">>;
|
|
28
29
|
/**
|
|
29
30
|
* @deprecated Now just `Video`
|
|
@@ -57,6 +58,7 @@ export declare const experimental_Video: import("react").ComponentType<{
|
|
|
57
58
|
headless: boolean;
|
|
58
59
|
onError: import("./on-error").MediaOnError | undefined;
|
|
59
60
|
credentials: RequestCredentials | undefined;
|
|
61
|
+
requestInit: import("./request-init").MediaRequestInit | undefined;
|
|
60
62
|
objectFit: import(".").VideoObjectFit;
|
|
61
63
|
_experimentalInitiallyDrawCachedFrame: boolean;
|
|
62
64
|
effects: import("remotion").EffectsProp;
|
|
@@ -64,6 +66,7 @@ export declare const experimental_Video: import("react").ComponentType<{
|
|
|
64
66
|
export { AudioForPreview } from './audio/audio-for-preview';
|
|
65
67
|
export { AudioProps, FallbackHtml5AudioProps } from './audio/props';
|
|
66
68
|
export { MediaErrorAction } from './on-error';
|
|
69
|
+
export type { MediaRequestInit } from './request-init';
|
|
67
70
|
export { FallbackOffthreadVideoProps, VideoObjectFit, VideoProps, } from './video/props';
|
|
68
71
|
export { getTargetSampleRate } from './convert-audiodata/resample-audiodata';
|
|
69
72
|
export { Audio, Video };
|
package/dist/media-player.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { EffectDefinitionAndStack, LogLevel, useBufferState } from 'remotion';
|
|
2
|
-
import type { EffectChainState } from 'remotion';
|
|
1
|
+
import type { EffectChainState, EffectDefinitionAndStack, LogLevel, useBufferState } from 'remotion';
|
|
3
2
|
import { type AudioIteratorManager } from './audio-iterator-manager';
|
|
3
|
+
import type { MediaRequestInit } from './request-init';
|
|
4
4
|
import type { SharedAudioContextForMediaPlayer } from './shared-audio-context-for-media-player';
|
|
5
5
|
import type { VideoIteratorManager } from './video-iterator-manager';
|
|
6
6
|
export type MediaPlayerInitResult = {
|
|
@@ -45,7 +45,7 @@ export declare class MediaPlayer {
|
|
|
45
45
|
private initializationPromise;
|
|
46
46
|
private premountAwareDelayPlayback;
|
|
47
47
|
private seekPromiseChain;
|
|
48
|
-
constructor({ canvas, src, logLevel, sharedAudioContext, loop, trimBefore, trimAfter, playbackRate, globalPlaybackRate, audioStreamIndex, fps, debugOverlay, bufferState, isPremounting, isPostmounting, durationInFrames, onVideoFrameCallback, playing, sequenceOffset, credentials, tagType, getEffects, getEffectChainState }: {
|
|
48
|
+
constructor({ canvas, src, logLevel, sharedAudioContext, loop, trimBefore, trimAfter, playbackRate, globalPlaybackRate, audioStreamIndex, fps, debugOverlay, bufferState, isPremounting, isPostmounting, durationInFrames, onVideoFrameCallback, playing, sequenceOffset, credentials, requestInit, tagType, getEffects, getEffectChainState }: {
|
|
49
49
|
canvas: HTMLCanvasElement | OffscreenCanvas | null;
|
|
50
50
|
src: string;
|
|
51
51
|
logLevel: LogLevel;
|
|
@@ -66,6 +66,7 @@ export declare class MediaPlayer {
|
|
|
66
66
|
playing: boolean;
|
|
67
67
|
sequenceOffset: number;
|
|
68
68
|
credentials: RequestCredentials | undefined;
|
|
69
|
+
requestInit: MediaRequestInit | undefined;
|
|
69
70
|
tagType: 'audio' | 'video';
|
|
70
71
|
getEffects: () => EffectDefinitionAndStack<unknown>[];
|
|
71
72
|
getEffectChainState: (width: number, height: number) => EffectChainState | null;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export type MediaHeadersInit = Record<string, string> | [string, string][];
|
|
2
|
+
export type MediaRequestInit = {
|
|
3
|
+
cache?: RequestCache;
|
|
4
|
+
credentials?: RequestCredentials;
|
|
5
|
+
headers?: MediaHeadersInit;
|
|
6
|
+
integrity?: string;
|
|
7
|
+
mode?: RequestMode;
|
|
8
|
+
redirect?: RequestRedirect;
|
|
9
|
+
referrer?: string;
|
|
10
|
+
referrerPolicy?: ReferrerPolicy;
|
|
11
|
+
};
|
|
12
|
+
export type MediaRequestInitOptions = {
|
|
13
|
+
credentials: RequestCredentials | undefined;
|
|
14
|
+
requestInit: MediaRequestInit | undefined;
|
|
15
|
+
};
|
|
16
|
+
export declare const normalizeMediaHeaders: (headers: HeadersInit | undefined) => [string, string][] | undefined;
|
|
17
|
+
export declare const normalizeMediaRequestInit: (requestInit: MediaRequestInit | undefined) => MediaRequestInit | undefined;
|
|
18
|
+
export declare const getMediaRequestInitFingerprint: (requestInit: MediaRequestInit | undefined) => (string | [string, string][] | Record<string, string> | null)[] | null;
|
|
19
|
+
export declare const resolveRequestInit: ({ credentials, requestInit, }: MediaRequestInitOptions) => MediaRequestInit | undefined;
|
package/dist/video/props.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { EffectDefinitionAndStack, EffectsProp, LogLevel, LoopVolumeCurveBehavior, OnVideoFrame, SequenceProps, VolumeProp } from 'remotion';
|
|
2
2
|
import type { MediaOnError } from '../on-error';
|
|
3
|
+
import type { MediaRequestInit } from '../request-init';
|
|
3
4
|
export type MediaErrorEvent = {
|
|
4
5
|
error: Error;
|
|
5
6
|
};
|
|
@@ -48,7 +49,12 @@ type OptionalVideoProps = {
|
|
|
48
49
|
debugOverlay: boolean;
|
|
49
50
|
headless: boolean;
|
|
50
51
|
onError: MediaOnError | undefined;
|
|
52
|
+
/**
|
|
53
|
+
* @deprecated Use `requestInit={{credentials: ...}}` instead. If both are
|
|
54
|
+
* passed, `requestInit.credentials` wins over this prop.
|
|
55
|
+
*/
|
|
51
56
|
credentials: RequestCredentials | undefined;
|
|
57
|
+
requestInit: MediaRequestInit | undefined;
|
|
52
58
|
objectFit: VideoObjectFit;
|
|
53
59
|
_experimentalInitiallyDrawCachedFrame: boolean;
|
|
54
60
|
effects: EffectsProp;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { EffectDefinitionAndStack, LogLevel, LoopVolumeCurveBehavior, SequenceControls, VolumeProp } from 'remotion';
|
|
3
3
|
import { type MediaOnError } from '../on-error';
|
|
4
|
+
import type { MediaRequestInit } from '../request-init';
|
|
4
5
|
import type { FallbackOffthreadVideoProps, VideoObjectFit } from './props';
|
|
5
6
|
type VideoForPreviewProps = {
|
|
6
7
|
readonly src: string;
|
|
@@ -24,6 +25,7 @@ type VideoForPreviewProps = {
|
|
|
24
25
|
readonly headless: boolean;
|
|
25
26
|
readonly onError: MediaOnError | undefined;
|
|
26
27
|
readonly credentials: RequestCredentials | undefined;
|
|
28
|
+
readonly requestInit: MediaRequestInit | undefined;
|
|
27
29
|
readonly objectFit: VideoObjectFit;
|
|
28
30
|
readonly setMediaDurationInSeconds: (durationInSeconds: number) => void;
|
|
29
31
|
readonly _experimentalInitiallyDrawCachedFrame: boolean;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { LogLevel, LoopVolumeCurveBehavior, OnVideoFrame, VolumeProp } from 'remotion';
|
|
3
3
|
import { type MediaOnError } from '../on-error';
|
|
4
|
+
import type { MediaRequestInit } from '../request-init';
|
|
4
5
|
import type { FallbackOffthreadVideoProps, VideoObjectFit } from './props';
|
|
5
6
|
type InnerVideoProps = {
|
|
6
7
|
readonly className: string | undefined;
|
|
@@ -25,6 +26,7 @@ type InnerVideoProps = {
|
|
|
25
26
|
readonly headless: boolean;
|
|
26
27
|
readonly onError: MediaOnError | undefined;
|
|
27
28
|
readonly credentials: RequestCredentials | undefined;
|
|
29
|
+
readonly requestInit: MediaRequestInit | undefined;
|
|
28
30
|
readonly objectFit: VideoObjectFit;
|
|
29
31
|
};
|
|
30
32
|
export declare const VideoForRendering: React.FC<InnerVideoProps>;
|
package/dist/video/video.d.ts
CHANGED
|
@@ -28,6 +28,7 @@ export declare const Video: React.ComponentType<{
|
|
|
28
28
|
headless: boolean;
|
|
29
29
|
onError: import("../on-error").MediaOnError | undefined;
|
|
30
30
|
credentials: RequestCredentials | undefined;
|
|
31
|
+
requestInit: import("..").MediaRequestInit | undefined;
|
|
31
32
|
objectFit: import("./props").VideoObjectFit;
|
|
32
33
|
_experimentalInitiallyDrawCachedFrame: boolean;
|
|
33
34
|
effects: import("remotion").EffectsProp;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { LogLevel } from 'remotion';
|
|
2
2
|
import type { PcmS16AudioData } from '../convert-audiodata/convert-audiodata';
|
|
3
|
+
import type { MediaRequestInit } from '../request-init';
|
|
3
4
|
export type MessageFromMainTab = {
|
|
4
5
|
type: 'response-success';
|
|
5
6
|
id: string;
|
|
@@ -44,6 +45,7 @@ export type ExtractFrameRequest = {
|
|
|
44
45
|
fps: number;
|
|
45
46
|
maxCacheSize: number;
|
|
46
47
|
credentials: RequestCredentials | undefined;
|
|
48
|
+
requestInit?: MediaRequestInit;
|
|
47
49
|
};
|
|
48
50
|
export declare const addBroadcastChannelListener: () => void;
|
|
49
51
|
export declare const waitForMainTabToBeReady: (channel: BroadcastChannel) => Promise<void>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { PcmS16AudioData } from '../convert-audiodata/convert-audiodata';
|
|
2
|
+
import { type MediaRequestInit } from '../request-init';
|
|
2
3
|
export type ExtractFrameViaBroadcastChannelResult = {
|
|
3
4
|
type: 'success';
|
|
4
5
|
frame: ImageBitmap | null;
|
|
@@ -15,7 +16,7 @@ export type ExtractFrameViaBroadcastChannelResult = {
|
|
|
15
16
|
} | {
|
|
16
17
|
type: 'unknown-container-format';
|
|
17
18
|
};
|
|
18
|
-
export declare const extractFrameViaBroadcastChannel: ({ src, timeInSeconds, logLevel, durationInSeconds, playbackRate, includeAudio, includeVideo, isClientSideRendering, loop, audioStreamIndex, trimAfter, trimBefore, fps, maxCacheSize, credentials, }: {
|
|
19
|
+
export declare const extractFrameViaBroadcastChannel: ({ src, timeInSeconds, logLevel, durationInSeconds, playbackRate, includeAudio, includeVideo, isClientSideRendering, loop, audioStreamIndex, trimAfter, trimBefore, fps, maxCacheSize, credentials, requestInit, }: {
|
|
19
20
|
src: string;
|
|
20
21
|
timeInSeconds: number;
|
|
21
22
|
durationInSeconds: number;
|
|
@@ -31,4 +32,5 @@ export declare const extractFrameViaBroadcastChannel: ({ src, timeInSeconds, log
|
|
|
31
32
|
fps: number;
|
|
32
33
|
maxCacheSize: number;
|
|
33
34
|
credentials: RequestCredentials | undefined;
|
|
35
|
+
requestInit?: MediaRequestInit | undefined;
|
|
34
36
|
}) => Promise<ExtractFrameViaBroadcastChannelResult>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type LogLevel } from 'remotion';
|
|
2
|
+
import type { MediaRequestInit } from '../request-init';
|
|
2
3
|
type ExtractFrameResult = {
|
|
3
4
|
type: 'success';
|
|
4
5
|
frame: VideoFrame | null;
|
|
@@ -26,6 +27,7 @@ type ExtractFrameParams = {
|
|
|
26
27
|
fps: number;
|
|
27
28
|
maxCacheSize: number;
|
|
28
29
|
credentials: RequestCredentials | undefined;
|
|
30
|
+
requestInit?: MediaRequestInit;
|
|
29
31
|
};
|
|
30
32
|
export declare const extractFrame: (params: ExtractFrameParams) => Promise<ExtractFrameResult>;
|
|
31
33
|
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AudioSampleSink, VideoSampleSink } from 'mediabunny';
|
|
2
|
+
import type { MediaRequestInit } from '../request-init';
|
|
2
3
|
type VideoSinks = {
|
|
3
4
|
sampleSink: VideoSampleSink;
|
|
4
5
|
};
|
|
@@ -7,7 +8,7 @@ type AudioSinks = {
|
|
|
7
8
|
};
|
|
8
9
|
export type AudioSinkResult = AudioSinks | 'no-audio-track' | 'cannot-decode-audio' | 'unknown-container-format' | 'network-error';
|
|
9
10
|
export type VideoSinkResult = VideoSinks | 'no-video-track' | 'cannot-decode' | 'cannot-decode-alpha' | 'unknown-container-format' | 'network-error';
|
|
10
|
-
export declare const getSinks: (src: string, credentials: RequestCredentials | undefined) => Promise<{
|
|
11
|
+
export declare const getSinks: (src: string, credentials: RequestCredentials | undefined, requestInit?: MediaRequestInit | undefined) => Promise<{
|
|
11
12
|
getVideo: () => Promise<VideoSinkResult>;
|
|
12
13
|
getAudio: (index: number | null) => Promise<AudioSinkResult>;
|
|
13
14
|
actualMatroskaTimestamps: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remotion/media",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.468",
|
|
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.45.0",
|
|
26
|
-
"remotion": "4.0.
|
|
26
|
+
"remotion": "4.0.468",
|
|
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.468",
|
|
35
35
|
"@vitest/browser-webdriverio": "4.0.9",
|
|
36
36
|
"eslint": "9.19.0",
|
|
37
37
|
"react": "19.2.3",
|