@remotion/media 4.0.352 → 4.0.354
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-rendering.js +37 -27
- package/dist/audio/audio.js +6 -3
- package/dist/audio/props.d.ts +1 -7
- package/dist/audio-extraction/audio-iterator.d.ts +1 -1
- package/dist/audio-extraction/audio-iterator.js +2 -2
- package/dist/audio-extraction/audio-manager.d.ts +1 -1
- package/dist/audio-extraction/extract-audio.d.ts +7 -4
- package/dist/audio-extraction/extract-audio.js +16 -7
- package/dist/caches.d.ts +6 -6
- package/dist/caches.js +5 -6
- package/dist/convert-audiodata/apply-volume.d.ts +1 -0
- package/dist/convert-audiodata/apply-volume.js +17 -0
- package/dist/convert-audiodata/convert-audiodata.d.ts +2 -2
- package/dist/convert-audiodata/convert-audiodata.js +13 -7
- package/dist/convert-audiodata/resample-audiodata.d.ts +1 -2
- package/dist/convert-audiodata/resample-audiodata.js +42 -20
- package/dist/esm/index.mjs +242 -182
- package/dist/extract-frame-and-audio.d.ts +3 -2
- package/dist/extract-frame-and-audio.js +4 -3
- package/dist/looped-frame.d.ts +9 -0
- package/dist/looped-frame.js +10 -0
- package/dist/video/media-player.d.ts +28 -30
- package/dist/video/media-player.js +174 -314
- package/dist/video/new-video-for-preview.d.ts +1 -1
- package/dist/video/new-video-for-preview.js +12 -18
- package/dist/video/props.d.ts +0 -5
- package/dist/video/timeout-utils.d.ts +2 -0
- package/dist/video/timeout-utils.js +18 -0
- package/dist/video/video-for-preview.d.ts +11 -0
- package/dist/video/video-for-preview.js +113 -0
- package/dist/video/video-for-rendering.js +41 -31
- package/dist/video/video.js +2 -2
- package/dist/video-extraction/extract-frame-via-broadcast-channel.d.ts +4 -3
- package/dist/video-extraction/extract-frame-via-broadcast-channel.js +9 -5
- package/dist/video-extraction/extract-frame.d.ts +1 -1
- package/dist/video-extraction/extract-frame.js +3 -0
- package/dist/video-extraction/get-frames-since-keyframe.d.ts +1 -1
- package/dist/video-extraction/get-frames-since-keyframe.js +7 -8
- package/dist/video-extraction/keyframe-bank.d.ts +1 -1
- package/dist/video-extraction/keyframe-bank.js +7 -7
- package/dist/video-extraction/keyframe-manager.d.ts +1 -1
- package/dist/video-extraction/keyframe-manager.js +6 -6
- package/package.json +3 -3
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import type { LogLevel } from 'remotion';
|
|
2
2
|
import type { PcmS16AudioData } from './convert-audiodata/convert-audiodata';
|
|
3
|
-
export declare const extractFrameAndAudio: ({ src, timeInSeconds, logLevel, durationInSeconds, includeAudio, includeVideo,
|
|
3
|
+
export declare const extractFrameAndAudio: ({ src, timeInSeconds, logLevel, durationInSeconds, playbackRate, includeAudio, includeVideo, loop, }: {
|
|
4
4
|
src: string;
|
|
5
5
|
timeInSeconds: number;
|
|
6
6
|
logLevel: LogLevel;
|
|
7
7
|
durationInSeconds: number;
|
|
8
|
+
playbackRate: number;
|
|
8
9
|
includeAudio: boolean;
|
|
9
10
|
includeVideo: boolean;
|
|
10
|
-
volume: number;
|
|
11
11
|
loop: boolean;
|
|
12
12
|
}) => Promise<{
|
|
13
13
|
frame: VideoFrame | null;
|
|
14
14
|
audio: PcmS16AudioData | null;
|
|
15
|
+
durationInSeconds: number | null;
|
|
15
16
|
}>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { extractAudio } from './audio-extraction/extract-audio';
|
|
2
2
|
import { extractFrame } from './video-extraction/extract-frame';
|
|
3
|
-
export const extractFrameAndAudio = async ({ src, timeInSeconds, logLevel, durationInSeconds, includeAudio, includeVideo,
|
|
3
|
+
export const extractFrameAndAudio = async ({ src, timeInSeconds, logLevel, durationInSeconds, playbackRate, includeAudio, includeVideo, loop, }) => {
|
|
4
4
|
const [frame, audio] = await Promise.all([
|
|
5
5
|
includeVideo
|
|
6
6
|
? extractFrame({
|
|
@@ -15,14 +15,15 @@ export const extractFrameAndAudio = async ({ src, timeInSeconds, logLevel, durat
|
|
|
15
15
|
src,
|
|
16
16
|
timeInSeconds,
|
|
17
17
|
durationInSeconds,
|
|
18
|
-
volume,
|
|
19
18
|
logLevel,
|
|
20
19
|
loop,
|
|
20
|
+
playbackRate,
|
|
21
21
|
})
|
|
22
22
|
: null,
|
|
23
23
|
]);
|
|
24
24
|
return {
|
|
25
25
|
frame: frame?.toVideoFrame() ?? null,
|
|
26
|
-
audio,
|
|
26
|
+
audio: audio?.data ?? null,
|
|
27
|
+
durationInSeconds: audio?.durationInSeconds ?? null,
|
|
27
28
|
};
|
|
28
29
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type LoopVolumeCurveBehavior } from 'remotion';
|
|
2
|
+
export declare const frameForVolumeProp: ({ behavior, loop, assetDurationInSeconds, fps, frame, startsAt, }: {
|
|
3
|
+
behavior: LoopVolumeCurveBehavior;
|
|
4
|
+
loop: boolean;
|
|
5
|
+
assetDurationInSeconds: number;
|
|
6
|
+
fps: number;
|
|
7
|
+
frame: number;
|
|
8
|
+
startsAt: number;
|
|
9
|
+
}) => number;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export const frameForVolumeProp = ({ behavior, loop, assetDurationInSeconds, fps, frame, startsAt, }) => {
|
|
2
|
+
if (!loop) {
|
|
3
|
+
return frame + startsAt;
|
|
4
|
+
}
|
|
5
|
+
if (behavior === 'extend') {
|
|
6
|
+
return frame + startsAt;
|
|
7
|
+
}
|
|
8
|
+
const assetDurationInFrames = Math.floor(assetDurationInSeconds * fps) - startsAt;
|
|
9
|
+
return (frame % assetDurationInFrames) + startsAt;
|
|
10
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { LogLevel } from 'remotion';
|
|
2
|
+
export declare const SEEK_THRESHOLD = 0.05;
|
|
2
3
|
export declare class MediaPlayer {
|
|
3
4
|
private canvas;
|
|
4
5
|
private context;
|
|
@@ -11,54 +12,51 @@ export declare class MediaPlayer {
|
|
|
11
12
|
private audioBufferIterator;
|
|
12
13
|
private queuedAudioNodes;
|
|
13
14
|
private gainNode;
|
|
14
|
-
private expectedAudioTime;
|
|
15
15
|
private sharedAudioContext;
|
|
16
|
-
private
|
|
16
|
+
private audioSyncAnchor;
|
|
17
17
|
private playing;
|
|
18
18
|
private animationFrameId;
|
|
19
|
-
private
|
|
19
|
+
private videoAsyncId;
|
|
20
20
|
private initialized;
|
|
21
21
|
private totalDuration;
|
|
22
|
-
private
|
|
23
|
-
private
|
|
24
|
-
private
|
|
25
|
-
private
|
|
26
|
-
private
|
|
27
|
-
private isNetworkActive;
|
|
28
|
-
private isSeeking;
|
|
29
|
-
private canStartAudio;
|
|
22
|
+
private isBuffering;
|
|
23
|
+
private onBufferingChangeCallback?;
|
|
24
|
+
private audioBufferHealth;
|
|
25
|
+
private audioIteratorStarted;
|
|
26
|
+
private readonly HEALTHY_BUFER_THRESHOLD_SECONDS;
|
|
30
27
|
constructor({ canvas, src, logLevel, sharedAudioContext, }: {
|
|
31
28
|
canvas: HTMLCanvasElement;
|
|
32
29
|
src: string;
|
|
33
30
|
logLevel: LogLevel;
|
|
34
|
-
sharedAudioContext
|
|
31
|
+
sharedAudioContext: AudioContext;
|
|
35
32
|
});
|
|
33
|
+
private input;
|
|
34
|
+
private isReady;
|
|
35
|
+
private hasAudio;
|
|
36
|
+
private isCurrentlyBuffering;
|
|
36
37
|
initialize(startTime?: number): Promise<void>;
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
private cleanupAudioQueue;
|
|
39
|
+
private cleanAudioIteratorAndNodes;
|
|
40
|
+
seekTo(time: number): Promise<void>;
|
|
39
41
|
play(): Promise<void>;
|
|
40
42
|
pause(): void;
|
|
41
43
|
dispose(): void;
|
|
42
|
-
get currentTime(): number;
|
|
43
44
|
private getPlaybackTime;
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
onStalledChange(callback: (isStalled: boolean) => void): void;
|
|
48
|
-
private renderSingleFrame;
|
|
45
|
+
private scheduleAudioChunk;
|
|
46
|
+
onBufferingChange(callback: (isBuffering: boolean) => void): void;
|
|
47
|
+
private canRenderVideo;
|
|
49
48
|
private startRenderLoop;
|
|
50
49
|
private stopRenderLoop;
|
|
51
50
|
private render;
|
|
51
|
+
private shouldRenderFrame;
|
|
52
|
+
private drawCurrentFrame;
|
|
53
|
+
private startAudioIterator;
|
|
52
54
|
private startVideoIterator;
|
|
53
55
|
private updateNextFrame;
|
|
54
|
-
private
|
|
55
|
-
private
|
|
56
|
-
private
|
|
57
|
-
private
|
|
58
|
-
private
|
|
59
|
-
private isNetworkStalled;
|
|
60
|
-
private checkVideoStall;
|
|
61
|
-
private checkIfStalled;
|
|
62
|
-
private updateStalledState;
|
|
56
|
+
private bufferingStartedAtMs;
|
|
57
|
+
private minBufferingTimeoutMs;
|
|
58
|
+
private setBufferingState;
|
|
59
|
+
private maybeResumeFromBuffering;
|
|
60
|
+
private maybeForceResumeFromBuffering;
|
|
63
61
|
private runAudioIterator;
|
|
64
62
|
}
|