@remotion/media 4.0.428 → 4.0.430
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/README.md +7 -7
- package/dist/audio/allow-wait.js +15 -0
- package/dist/audio/audio-for-preview.d.ts +0 -1
- package/dist/audio/audio-for-preview.js +304 -0
- package/dist/audio/audio-for-rendering.js +194 -0
- package/dist/audio/audio-preview-iterator.d.ts +4 -2
- package/dist/audio/audio-preview-iterator.js +176 -0
- package/dist/audio/audio.js +20 -0
- package/dist/audio/props.js +1 -0
- package/dist/audio-extraction/audio-cache.js +66 -0
- package/dist/audio-extraction/audio-iterator.js +132 -0
- package/dist/audio-extraction/audio-manager.js +113 -0
- package/dist/audio-extraction/extract-audio.js +132 -0
- package/dist/audio-iterator-manager.d.ts +10 -9
- package/dist/audio-iterator-manager.js +228 -0
- package/dist/browser-can-use-webgl2.js +13 -0
- package/dist/caches.js +61 -0
- package/dist/calculate-playbacktime.js +4 -0
- package/dist/convert-audiodata/apply-volume.js +17 -0
- package/dist/convert-audiodata/combine-audiodata.js +23 -0
- package/dist/convert-audiodata/convert-audiodata.js +73 -0
- package/dist/convert-audiodata/resample-audiodata.js +94 -0
- package/dist/debug-overlay/preview-overlay.d.ts +9 -7
- package/dist/debug-overlay/preview-overlay.js +42 -0
- package/dist/esm/index.mjs +246 -103
- package/dist/extract-frame-and-audio.js +101 -0
- package/dist/get-sink.js +15 -0
- package/dist/get-time-in-seconds.js +40 -0
- package/dist/helpers/round-to-4-digits.js +4 -0
- package/dist/index.js +12 -0
- package/dist/is-type-of-error.js +20 -0
- package/dist/looped-frame.js +10 -0
- package/dist/media-player.d.ts +9 -5
- package/dist/media-player.js +431 -0
- package/dist/nonce-manager.js +13 -0
- package/dist/prewarm-iterator-for-looping.js +56 -0
- package/dist/render-timestamp-range.js +9 -0
- package/dist/show-in-timeline.js +31 -0
- package/dist/use-media-in-timeline.d.ts +3 -2
- package/dist/use-media-in-timeline.js +103 -0
- package/dist/video/props.js +1 -0
- package/dist/video/video-for-preview.js +331 -0
- package/dist/video/video-for-rendering.js +263 -0
- package/dist/video/video-preview-iterator.js +122 -0
- package/dist/video/video.js +35 -0
- package/dist/video-extraction/add-broadcast-channel-listener.js +125 -0
- package/dist/video-extraction/extract-frame-via-broadcast-channel.js +113 -0
- package/dist/video-extraction/extract-frame.js +85 -0
- package/dist/video-extraction/get-allocation-size.js +6 -0
- package/dist/video-extraction/get-frames-since-keyframe.js +108 -0
- package/dist/video-extraction/keyframe-bank.js +159 -0
- package/dist/video-extraction/keyframe-manager.js +206 -0
- package/dist/video-extraction/remember-actual-matroska-timestamps.js +19 -0
- package/dist/video-extraction/rotate-frame.js +34 -0
- package/dist/video-iterator-manager.js +109 -0
- package/package.json +7 -5
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export const drawPreviewOverlay = ({ context, audioTime, audioContextState, audioSyncAnchor, playing, audioIteratorManager, videoIteratorManager, }) => {
|
|
2
|
+
// Collect all lines to be rendered
|
|
3
|
+
const lines = [
|
|
4
|
+
'Debug overlay',
|
|
5
|
+
`Video iterators created: ${videoIteratorManager?.getVideoIteratorsCreated()}`,
|
|
6
|
+
`Audio iterators created: ${audioIteratorManager?.getAudioIteratorsCreated()}`,
|
|
7
|
+
`Frames rendered: ${videoIteratorManager?.getFramesRendered()}`,
|
|
8
|
+
`Audio context state: ${audioContextState}`,
|
|
9
|
+
`Audio time: ${(audioTime - audioSyncAnchor).toFixed(3)}s`,
|
|
10
|
+
];
|
|
11
|
+
if (audioIteratorManager) {
|
|
12
|
+
const queuedPeriod = audioIteratorManager
|
|
13
|
+
.getAudioBufferIterator()
|
|
14
|
+
?.getQueuedPeriod();
|
|
15
|
+
const numberOfChunksAfterResuming = audioIteratorManager
|
|
16
|
+
?.getAudioBufferIterator()
|
|
17
|
+
?.getNumberOfChunksAfterResuming();
|
|
18
|
+
if (queuedPeriod) {
|
|
19
|
+
lines.push(`Audio queued until: ${(queuedPeriod.until - (audioTime - audioSyncAnchor)).toFixed(3)}s`);
|
|
20
|
+
}
|
|
21
|
+
else if (numberOfChunksAfterResuming) {
|
|
22
|
+
lines.push(`Audio chunks for after resuming: ${numberOfChunksAfterResuming}`);
|
|
23
|
+
}
|
|
24
|
+
lines.push(`Playing: ${playing}`);
|
|
25
|
+
}
|
|
26
|
+
const lineHeight = 30; // px, should match or exceed font size
|
|
27
|
+
const boxPaddingX = 10;
|
|
28
|
+
const boxPaddingY = 10;
|
|
29
|
+
const boxLeft = 20;
|
|
30
|
+
const boxTop = 20;
|
|
31
|
+
const boxWidth = 600;
|
|
32
|
+
const boxHeight = lines.length * lineHeight + 2 * boxPaddingY;
|
|
33
|
+
// Draw background for text legibility
|
|
34
|
+
context.fillStyle = 'rgba(0, 0, 0, 1)';
|
|
35
|
+
context.fillRect(boxLeft, boxTop, boxWidth, boxHeight);
|
|
36
|
+
context.fillStyle = 'white';
|
|
37
|
+
context.font = '24px sans-serif';
|
|
38
|
+
context.textBaseline = 'top';
|
|
39
|
+
for (let i = 0; i < lines.length; i++) {
|
|
40
|
+
context.fillText(lines[i], boxLeft + boxPaddingX, boxTop + boxPaddingY + i * lineHeight);
|
|
41
|
+
}
|
|
42
|
+
};
|