🎥 Make videos programmatically with React
Improve Canvas Capture toolbar controls
JonnyBurgerbbed41139124
diff --git a/packages/canvas-capture-extension/src/content.ts b/packages/canvas-capture-extension/src/content.tsindex 12fc0639c7..ee5db8a399 100644--- a/packages/canvas-capture-extension/src/content.ts+++ b/packages/canvas-capture-extension/src/content.ts@@ -197,13 +197,15 @@ export const startContent = () => {cursor: pointer;}.capture-controls {+ --capture-controls-icon-color: #737373;+position: fixed;left: 50%;bottom: 20px;display: none;align-items: center;gap: 6px;- width: fit-content;+ width: 224px;max-width: calc(100vw - 40px);padding: 8px;border: 2px solid #000;@@ -248,29 +250,23 @@ export const startContent = () => {}.capture-controls-grab {display: block;- width: 20px;- height: 20px;+ width: 24px;+ height: 24px;+ color: var(--capture-controls-icon-color);fill: currentColor;- opacity: 0.55;- }- .capture-controls-logo {- display: block;- width: 25px;- height: 26px;- margin-left: -5px;}.capture-controls-close {- width: 40px;- flex: 0 0 40px !important;+ width: 32px;+ flex: 0 0 32px !important;border: 0 !important;background: transparent !important;- color: #555b61 !important;- opacity: 0.55;- padding: 7px;- transition: opacity 120ms ease;+ color: var(--capture-controls-icon-color) !important;+ margin-left: auto;+ padding: 4px;+ transition: color 120ms ease;}.capture-controls-close:hover:not(:disabled) {- opacity: 1;+ color: #000 !important;}.capture-controls-close svg {display: block;@@ -294,12 +290,12 @@ export const startContent = () => {flex: 0 0 32px;border: 0 !important;background: transparent !important;- opacity: 0.55;+ color: var(--capture-controls-icon-color) !important;padding: 4px;- transition: opacity 120ms ease;+ transition: color 120ms ease;}.capture-controls-select:hover:not(:disabled) {- opacity: 1;+ color: #000 !important;}.capture-controls-select + .capture-controls-select {margin-left: -6px;@@ -314,6 +310,10 @@ export const startContent = () => {cursor: default;opacity: 0.5;}+ .capture-controls button.capture-controls-select:disabled,+ .capture-controls button.capture-controls-close:disabled {+ opacity: 1;+ }.capture-controls [data-tooltip] {position: relative;}@@ -357,7 +357,8 @@ export const startContent = () => {perspective: 300px;}.capture-controls-duration {- min-width: 40px;+ width: 64px;+ flex: 0 0 64px;font-variant-numeric: tabular-nums;font-weight: 700;text-align: center;@@ -468,11 +469,6 @@ export const startContent = () => {controlsHeader.dataset.tooltip = 'Drag to reposition';controlsHeader.innerHTML ='<svg class="capture-controls-grab" viewBox="0 0 640 640" aria-hidden="true"><path d="M288 128C288 92.7 259.3 64 224 64C188.7 64 160 92.7 160 128C160 163.3 188.7 192 224 192C259.3 192 288 163.3 288 128zM288 320C288 284.7 259.3 256 224 256C188.7 256 160 284.7 160 320C160 355.3 188.7 384 224 384C259.3 384 288 355.3 288 320zM160 512C160 547.3 188.7 576 224 576C259.3 576 288 547.3 288 512C288 476.7 259.3 448 224 448C188.7 448 160 476.7 160 512zM480 128C480 92.7 451.3 64 416 64C380.7 64 352 92.7 352 128C352 163.3 380.7 192 416 192C451.3 192 480 163.3 480 128zM352 320C352 355.3 380.7 384 416 384C451.3 384 480 355.3 480 320C480 284.7 451.3 256 416 256C380.7 256 352 284.7 352 320zM480 512C480 476.7 451.3 448 416 448C380.7 448 352 476.7 352 512C352 547.3 380.7 576 416 576C451.3 576 480 547.3 480 512z"/></svg>';- const controlsLogo = document.createElement('img');- controlsLogo.className = 'capture-controls-logo';- controlsLogo.src =- 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAYAAABw4pVUAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAASbSURBVHgB7d1/TttIFAfw98a2RDeBDTfIDZaeoHCCZU9QeoKlf1ZQbaIG9U/aExROQDkB6QlwT4B7ArKEqFId+3UmhP5QJQr2vLE9fp8/ClVVQHzz5s1MMhMAIYQQQgghhBBCCCGEEEIIIRxCqFBvQL00vNohVE8QaAMI+4t/QEr05wkCxgTZJyQVh1k3ngxwAp6rJBATxJfo+l8k2DV/fcB/jQExBsg/RCoaT148SsAzzgPpHFxv6A8nQNSH8mJdRWP9tU6vX66OwQNOA1mEQXQGD6uK+0FM9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9LSqi8yaEsQtJ/f2mgMshHAGjqC5tF9XpnkwcO3KcnF3szX3Zcp6MxNzPNafjeXu93tafXW1nSt1aGn4mphKIMh1jwrGs72uF8/BOH+7ipXXl/0gCwb6Wz90fTJB1P0gh49g1g7ZPG7acHQflb3Dzk0wahtB/b2cFt8ccjFDD+GEzBu3UPZRESZBGMU+vnmLEEIIIYQQQgghhBBCCCFEG30F6Cu5JpPbnzQAAAAASUVORK5CYII=';- controlsLogo.alt = 'Remotion';const controlsSecondary = document.createElement('button');controlsSecondary.className = 'capture-controls-select';controlsSecondary.type = 'button';@@ -521,7 +517,7 @@ export const startContent = () => {controlsNew.ariaLabel = 'Open in remotion.dev/new';controlsNew.dataset.tooltip = 'Open in remotion.dev/new';controlsNew.innerHTML =- '<svg viewBox="0 0 512 512" aria-hidden="true"><path d="M80 48C53.5 48 32 69.5 32 96v320c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V176L352 48H80zm304 64.6L415.4 144H384v-31.4zM80 80h272v96h96v240c0 8.8-7.2 16-16 16H80c-8.8 0-16-7.2-16-16V96c0-8.8 7.2-16 16-16zm160 144v64h-64v32h64v64h32v-64h64v-32h-64v-64h-32z"/></svg>';+ '<svg viewBox="-24 -24 560 560" aria-hidden="true"><path d="M80 48C53.5 48 32 69.5 32 96v320c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V176L352 48H80zm304 64.6L415.4 144H384v-31.4zM80 80h272v96h96v240c0 8.8-7.2 16-16 16H80c-8.8 0-16-7.2-16-16V96c0-8.8 7.2-16 16-16zm160 144v64h-64v32h64v64h32v-64h64v-32h-64v-64h-32z"/></svg>';const controlsConvert = document.createElement('button');controlsConvert.className = 'capture-controls-select';controlsConvert.type = 'button';@@ -529,7 +525,7 @@ export const startContent = () => {controlsConvert.ariaLabel = 'Open in remotion.dev/convert';controlsConvert.dataset.tooltip = 'Open in remotion.dev/convert';controlsConvert.innerHTML =- '<svg viewBox="0 0 512 512" aria-hidden="true"><path d="M304 0c-8.8 0-16 7.2-16 16s7.2 16 16 16l153.4 0-260.7 260.7c-6.2 6.2-6.2 16.4 0 22.6s16.4 6.2 22.6 0L480 54.6 480 208c0 8.8 7.2 16 16 16s16-7.2 16-16l0-192c0-8.8-7.2-16-16-16L304 0zM80 96C35.8 96 0 131.8 0 176L0 432c0 44.2 35.8 80 80 80l256 0c44.2 0 80-35.8 80-80l0-96c0-8.8-7.2-16-16-16s-16 7.2-16 16l0 96c0 26.5-21.5 48-48 48L80 480c-26.5 0-48-21.5-48-48l0-256c0-26.5 21.5-48 48-48l96 0c8.8 0 16-7.2 16-16s-7.2-16-16-16L80 96z"/></svg>';+ '<svg viewBox="-64 -64 640 640" aria-hidden="true"><path d="M304 0c-8.8 0-16 7.2-16 16s7.2 16 16 16l153.4 0-260.7 260.7c-6.2 6.2-6.2 16.4 0 22.6s16.4 6.2 22.6 0L480 54.6 480 208c0 8.8 7.2 16 16 16s16-7.2 16-16l0-192c0-8.8-7.2-16-16-16L304 0zM80 96C35.8 96 0 131.8 0 176L0 432c0 44.2 35.8 80 80 80l256 0c44.2 0 80-35.8 80-80l0-96c0-8.8-7.2-16-16-16s-16 7.2-16 16l0 96c0 26.5-21.5 48-48 48L80 480c-26.5 0-48-21.5-48-48l0-256c0-26.5 21.5-48 48-48l96 0c8.8 0 16-7.2 16-16s-7.2-16-16-16L80 96z"/></svg>';const controlsDownload = document.createElement('button');controlsDownload.className = 'capture-controls-select';controlsDownload.type = 'button';@@ -537,18 +533,17 @@ export const startContent = () => {controlsDownload.ariaLabel = 'Download recording';controlsDownload.dataset.tooltip = 'Download recording';controlsDownload.innerHTML =- '<svg viewBox="0 0 384 512" aria-hidden="true"><path d="M0 496c0-8.8 7.2-16 16-16l352 0c8.8 0 16 7.2 16 16s-7.2 16-16 16L16 512c-8.8 0-16-7.2-16-16zM209 377c-9.4 9.4-24.6 9.4-33.9 0L31 233c-6.9-6.9-8.9-17.2-5.2-26.2S38.3 192 48 192l80 0 0-64 0 0 0-80c0-26.5 21.5-48 48-48l32 0c26.5 0 48 21.5 48 48l0 144 80 0c9.7 0 18.5 5.8 22.2 14.8s1.7 19.3-5.2 26.2L209 377zm15-249l0-80c0-8.8-7.2-16-16-16l-32 0c-8.8 0-16 7.2-16 16l0 80 0 0 0 80c0 8.8-7.2 16-16 16L67.3 224 192 348.7 316.7 224 240 224c-8.8 0-16-7.2-16-16l0-80z"/></svg>';+ '<svg viewBox="-128 -64 640 640" aria-hidden="true"><path d="M0 496c0-8.8 7.2-16 16-16l352 0c8.8 0 16 7.2 16 16s-7.2 16-16 16L16 512c-8.8 0-16-7.2-16-16zM209 377c-9.4 9.4-24.6 9.4-33.9 0L31 233c-6.9-6.9-8.9-17.2-5.2-26.2S38.3 192 48 192l80 0 0-64 0 0 0-80c0-26.5 21.5-48 48-48l32 0c26.5 0 48 21.5 48 48l0 144 80 0c9.7 0 18.5 5.8 22.2 14.8s1.7 19.3-5.2 26.2L209 377zm15-249l0-80c0-8.8-7.2-16-16-16l-32 0c-8.8 0-16 7.2-16 16l0 80 0 0 0 80c0 8.8-7.2 16-16 16L67.3 224 192 348.7 316.7 224 240 224c-8.8 0-16-7.2-16-16l0-80z"/></svg>';const controlsClose = document.createElement('button');controlsClose.className = 'capture-controls-close';controlsClose.type = 'button';controlsClose.ariaLabel = 'Close capture controls';controlsClose.dataset.tooltip = 'Close';controlsClose.innerHTML =- '<svg viewBox="0 0 640 640" aria-hidden="true"><path d="M135.5 169C126.1 159.6 126.1 144.4 135.5 135.1C144.9 125.8 160.1 125.7 169.4 135.1L320.4 286.1L471.4 135.1C480.8 125.7 496 125.7 505.3 135.1C514.6 144.5 514.7 159.7 505.3 169L354.3 320L505.3 471C514.7 480.4 514.7 495.6 505.3 504.9C495.9 514.2 480.7 514.3 471.4 504.9L320.4 353.9L169.4 504.9C160 514.3 144.8 514.3 135.5 504.9C126.2 495.5 126.1 480.3 135.5 471L286.5 320L135.5 169z"/></svg>';+ '<svg viewBox="46 46 548 548" aria-hidden="true"><path d="M135.5 169C126.1 159.6 126.1 144.4 135.5 135.1C144.9 125.8 160.1 125.7 169.4 135.1L320.4 286.1L471.4 135.1C480.8 125.7 496 125.7 505.3 135.1C514.6 144.5 514.7 159.7 505.3 169L354.3 320L505.3 471C514.7 480.4 514.7 495.6 505.3 504.9C495.9 514.2 480.7 514.3 471.4 504.9L320.4 353.9L169.4 504.9C160 514.3 144.8 514.3 135.5 504.9C126.2 495.5 126.1 480.3 135.5 471L286.5 320L135.5 169z"/></svg>';controls.append(controlsEncodingError,controlsHeader,- controlsLogo,controlsSecondary,controlsWholePage,controlsDuration,@@ -897,10 +892,10 @@ export const startContent = () => {dimensionsZoomSlider.disabled = dimensionsZoom.disabled;controlsSecondary.disabled =controlsBusy || state.recording || state.hasCompletedRecording;- controlsSecondary.hidden = state.recording;+ controlsSecondary.hidden = state.recording || state.hasCompletedRecording;controlsWholePage.disabled =controlsBusy || state.recording || state.hasCompletedRecording;- controlsWholePage.hidden = state.recording;+ controlsWholePage.hidden = state.recording || state.hasCompletedRecording;controlsDuration.hidden = !state.recording;controlsPrimary.hidden = state.hasCompletedRecording;controlsNew.hidden = !state.hasCompletedRecording;@@ -1124,7 +1119,7 @@ export const startContent = () => {}};- const consumeCompletedRecording = async (+ const handleCompletedRecording = async (destination: 'convert' | 'new' | 'download',) => {if (!completedRecording || finalizing) {@@ -1147,10 +1142,7 @@ export const startContent = () => {}downloadFile(file);- completedRecording = null;- setStatus(- `${getContainerLabel(format)} downloaded. Ready to record again.`,- );+ setStatus(`${getContainerLabel(format)} downloaded.`);} catch (error) {setStatus(error instanceof Error ? error.message : String(error), true);} finally {@@ -1301,7 +1293,7 @@ export const startContent = () => {return getState();}- await consumeCompletedRecording(+ await handleCompletedRecording(request.command === 'open-in-convert'? 'convert': request.command === 'open-in-new'