🎥 Make videos programmatically with React
Log Canvas Capture failures during recording and stop
JonnyBurgerda536ab33534
diff --git a/packages/canvas-capture-extension/src/capture.ts b/packages/canvas-capture-extension/src/capture.tsindex 40da973a9b..b608953a38 100644--- a/packages/canvas-capture-extension/src/capture.ts+++ b/packages/canvas-capture-extension/src/capture.ts@@ -441,7 +441,14 @@ export class PageCapture {try {this.#draw();} catch (error) {- this.#paintError = error;+ if (this.#paintError === null) {+ // eslint-disable-next-line no-console -- Surface capture failures in the page DevTools console.+ console.error(+ '[Remotion Canvas Capture] Failed to paint a frame',+ error,+ );+ this.#paintError = error;+ }}};}diff --git a/packages/canvas-capture-extension/src/content.ts b/packages/canvas-capture-extension/src/content.tsindex 89a043df0a..58f96dceb2 100644--- a/packages/canvas-capture-extension/src/content.ts+++ b/packages/canvas-capture-extension/src/content.ts@@ -1287,6 +1287,17 @@ export const startContent = () => {`${getContainerLabel(recordingFormat)} ready. Open it in Browser Studio, Convert, or download it.`,);} catch (error) {+ // eslint-disable-next-line no-console -- Surface stop failures in the page DevTools console.+ console.error(+ '[Remotion Canvas Capture] Failed to stop recording',+ {+ format: recordingFormat,+ outputSize,+ scale,+ target: selectedTarget?.type,+ },+ error,+ );setStatus(error instanceof Error ? error.message : String(error), true);} finally {capture = null;@@ -1603,6 +1614,11 @@ export const startContent = () => {action().catch((error) => {+ // eslint-disable-next-line no-console -- Surface unexpected control errors in the page DevTools console.+ console.error(+ `[Remotion Canvas Capture] Failed to ${state.recording ? 'stop' : 'start'} recording`,+ error,+ );setStatus(error instanceof Error ? error.message : String(error),true,diff --git a/packages/canvas-capture-extension/src/recorder.ts b/packages/canvas-capture-extension/src/recorder.tsindex 5e5bc9ff87..058ad4c2f9 100644--- a/packages/canvas-capture-extension/src/recorder.ts+++ b/packages/canvas-capture-extension/src/recorder.ts@@ -307,6 +307,12 @@ const addFrame = (recording: RecordingState, canvas: OffscreenCanvas) => {recording.encodingError = error;recording.pendingFrame?.close();recording.pendingFrame = null;+ // eslint-disable-next-line no-console -- Surface encoder failures in the page DevTools console.+ console.error(+ '[Remotion Canvas Capture] Failed to encode a frame',+ {frameCount: recording.frameCount},+ error,+ );throw error;} finally {recording.isEncodingFrame = false;