@remotion/media 4.0.365 → 4.0.366

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.
@@ -1,19 +1,11 @@
1
- import type { AudioIterator } from '../audio/audio-preview-iterator';
2
- export type DebugStats = {
3
- videoIteratorsCreated: number;
4
- audioIteratorsCreated: number;
5
- framesRendered: number;
6
- };
7
- export declare const drawPreviewOverlay: ({ context, stats, audioTime, audioContextState, audioIterator, audioSyncAnchor, audioChunksForAfterResuming, playing, }: {
8
- context: CanvasRenderingContext2D;
9
- stats: DebugStats;
1
+ import type { AudioIteratorManager } from '../audio-iterator-manager';
2
+ import type { VideoIteratorManager } from '../video-iterator-manager';
3
+ export declare const drawPreviewOverlay: ({ context, audioTime, audioContextState, audioSyncAnchor, playing, audioIteratorManager, videoIteratorManager, }: {
4
+ context: OffscreenCanvasRenderingContext2D | CanvasRenderingContext2D;
10
5
  audioTime: number;
11
6
  audioContextState: AudioContextState;
12
7
  audioSyncAnchor: number;
13
- audioIterator: AudioIterator | null;
14
- audioChunksForAfterResuming: {
15
- buffer: AudioBuffer;
16
- timestamp: number;
17
- }[];
18
8
  playing: boolean;
9
+ audioIteratorManager: AudioIteratorManager | null;
10
+ videoIteratorManager: VideoIteratorManager | null;
19
11
  }) => void;
@@ -1,20 +1,25 @@
1
- export const drawPreviewOverlay = ({ context, stats, audioTime, audioContextState, audioIterator, audioSyncAnchor, audioChunksForAfterResuming, playing, }) => {
1
+ export const drawPreviewOverlay = ({ context, audioTime, audioContextState, audioSyncAnchor, playing, audioIteratorManager, videoIteratorManager, }) => {
2
2
  // Collect all lines to be rendered
3
3
  const lines = [
4
4
  'Debug overlay',
5
- `Video iterators created: ${stats.videoIteratorsCreated}`,
6
- `Audio iterators created: ${stats.audioIteratorsCreated}`,
7
- `Frames rendered: ${stats.framesRendered}`,
5
+ `Video iterators created: ${videoIteratorManager?.getVideoIteratorsCreated()}`,
6
+ `Audio iterators created: ${audioIteratorManager?.getAudioIteratorsCreated()}`,
7
+ `Frames rendered: ${videoIteratorManager?.getFramesRendered()}`,
8
8
  `Audio context state: ${audioContextState}`,
9
9
  `Audio time: ${(audioTime - audioSyncAnchor).toFixed(3)}s`,
10
10
  ];
11
- if (audioIterator) {
12
- const queuedPeriod = audioIterator.getQueuedPeriod();
11
+ if (audioIteratorManager) {
12
+ const queuedPeriod = audioIteratorManager
13
+ .getAudioBufferIterator()
14
+ ?.getQueuedPeriod([]);
15
+ const numberOfChunksAfterResuming = audioIteratorManager
16
+ ?.getAudioBufferIterator()
17
+ ?.getNumberOfChunksAfterResuming();
13
18
  if (queuedPeriod) {
14
19
  lines.push(`Audio queued until: ${(queuedPeriod.until - (audioTime - audioSyncAnchor)).toFixed(3)}s`);
15
20
  }
16
- else if (audioChunksForAfterResuming.length > 0) {
17
- lines.push(`Audio chunks for after resuming: ${audioChunksForAfterResuming.length}`);
21
+ else if (numberOfChunksAfterResuming) {
22
+ lines.push(`Audio chunks for after resuming: ${numberOfChunksAfterResuming}`);
18
23
  }
19
24
  lines.push(`Playing: ${playing}`);
20
25
  }