🎥 Make videos programmatically with React
Create preview-overlay.ts
JonnyBurger8d27fb88b65b
diff --git a/packages/media/src/debug-overlay/preview-overlay.ts b/packages/media/src/debug-overlay/preview-overlay.tsnew file mode 100644index 0000000000..26dce428d7--- /dev/null+++ b/packages/media/src/debug-overlay/preview-overlay.ts@@ -0,0 +1,19 @@+import type {WrappedCanvas} from 'mediabunny';++export const drawPreviewOverlay = (+ context: CanvasRenderingContext2D,+ nextFrame: WrappedCanvas | null,+) => {+ // Optionally, set a background for text legibility+ context.fillStyle = 'rgba(0, 0, 0, 1)';+ context.fillRect(20, 20, 300, 100);++ context.fillStyle = 'white';+ context.font = '24px sans-serif';+ context.textBaseline = 'top';+ context.fillText(+ `next: ${nextFrame ? nextFrame.timestamp.toFixed(3) + 's' : null}`,+ 30,+ 30,+ );+};