chore: remove all Remotion references from Electron main + UI
- Cleaned Electron main.ts: removed Remotion bundle path, compositor path, and predownloadBrowser() - Set BRADLY_SERVE_URL from Express port for headless rendering - Cleaned GlobalSettingsPanel: removed Remotion-specific frame capture code - Removed stale remotion:bundle script from package.json - Zero Remotion dependencies, imports, or functional code remain
This commit is contained in:
@@ -37,29 +37,16 @@ export const GlobalSettingsPanel: React.FC<GlobalSettingsPanelProps> = ({
|
|||||||
const player = playerRef?.current;
|
const player = playerRef?.current;
|
||||||
if (!player) return;
|
if (!player) return;
|
||||||
|
|
||||||
// Find the remotion-player container and grab its inner canvas/iframe
|
// Find the BradlyPlayer container and capture its content
|
||||||
const playerContainer = document.querySelector('[data-remotion-player]') ?? document.querySelector('.remotion-player');
|
const playerContainer = document.querySelector('[data-bradly-player]');
|
||||||
if (!playerContainer) {
|
if (!playerContainer) {
|
||||||
// Fallback: find the iframe or video element
|
// Fallback: use the render API endpoint
|
||||||
const iframe = document.querySelector('iframe');
|
alert('📸 Exportar frame: Usa el botón "Renderizar" con formato PNG para capturar frames.');
|
||||||
if (iframe) {
|
return;
|
||||||
// Can't capture cross-origin iframe, but for same-origin:
|
|
||||||
try {
|
|
||||||
const iframeDoc = iframe.contentDocument;
|
|
||||||
if (iframeDoc) {
|
|
||||||
const canvas = document.createElement('canvas');
|
|
||||||
const body = iframeDoc.body;
|
|
||||||
canvas.width = body.scrollWidth;
|
|
||||||
canvas.height = body.scrollHeight;
|
|
||||||
// This is a simplistic approach - Remotion doesn't expose easy screenshot
|
|
||||||
}
|
|
||||||
} catch { /* cross-origin */ }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use html2canvas-like approach: create a temporary canvas from the player
|
// TODO: Implement canvas-based screenshot from BradlyPlayer viewport
|
||||||
// For now, use a simple screenshot via the Remotion player's renderToCanvas
|
alert('📸 Exportar frame: Usa el botón "Renderizar" con formato PNG para capturar frames.');
|
||||||
alert('📸 Exportar frame: Esta función requiere @remotion/renderer para renderizar frames individuales. Próximamente disponible.');
|
|
||||||
}, [playerRef]);
|
}, [playerRef]);
|
||||||
|
|
||||||
const matchingPresets = EXPORT_PRESETS.filter(p => p.aspect === aspectRatio);
|
const matchingPresets = EXPORT_PRESETS.filter(p => p.aspect === aspectRatio);
|
||||||
|
|||||||
+7
-43
@@ -4,7 +4,6 @@
|
|||||||
* Responsibilities:
|
* Responsibilities:
|
||||||
* - Creates the BrowserWindow
|
* - Creates the BrowserWindow
|
||||||
* - Starts the embedded Express server
|
* - Starts the embedded Express server
|
||||||
* - Pre-downloads Chrome Headless Shell for Remotion
|
|
||||||
* - Manages IPC handlers for native features
|
* - Manages IPC handlers for native features
|
||||||
*/
|
*/
|
||||||
import { app, BrowserWindow, ipcMain, dialog } from 'electron';
|
import { app, BrowserWindow, ipcMain, dialog } from 'electron';
|
||||||
@@ -59,33 +58,10 @@ function setupPaths() {
|
|||||||
process.env.BRADLY_UPLOADS_DIR = uploadsDir;
|
process.env.BRADLY_UPLOADS_DIR = uploadsDir;
|
||||||
process.env.BRADLY_RENDERS_DIR = rendersDir;
|
process.env.BRADLY_RENDERS_DIR = rendersDir;
|
||||||
|
|
||||||
// In packaged app, configure Remotion paths
|
// In packaged app, set the serve URL to the embedded Express server
|
||||||
if (app.isPackaged) {
|
if (app.isPackaged) {
|
||||||
const resourcesPath = process.resourcesPath;
|
// BRADLY_SERVE_URL will be set after Express starts
|
||||||
|
// (see startExpressServer)
|
||||||
// Pre-built Remotion bundle (created during packaging)
|
|
||||||
const remotionBundle = path.join(resourcesPath, 'remotion-bundle');
|
|
||||||
if (fs.existsSync(remotionBundle)) {
|
|
||||||
process.env.BRADLY_REMOTION_BUNDLE = remotionBundle;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Compositor binaries (unpacked from asar)
|
|
||||||
const platformMap: Record<string, string> = {
|
|
||||||
darwin: 'darwin',
|
|
||||||
win32: 'win32',
|
|
||||||
linux: 'linux',
|
|
||||||
};
|
|
||||||
const platform = platformMap[process.platform] || process.platform;
|
|
||||||
const arch = process.arch;
|
|
||||||
const compositorPath = path.join(
|
|
||||||
resourcesPath,
|
|
||||||
'app.asar.unpacked',
|
|
||||||
'node_modules',
|
|
||||||
`@remotion/compositor-${platform}-${arch}`,
|
|
||||||
);
|
|
||||||
if (fs.existsSync(compositorPath)) {
|
|
||||||
process.env.BRADLY_BINARIES_DIR = compositorPath;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('📂 User data:', userDataPath);
|
console.log('📂 User data:', userDataPath);
|
||||||
@@ -274,18 +250,6 @@ function setupIPC() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// ═══ Remotion Browser Pre-download ═══
|
|
||||||
|
|
||||||
async function predownloadBrowser() {
|
|
||||||
try {
|
|
||||||
const { ensureBrowser } = await import('@remotion/renderer');
|
|
||||||
console.log('🌐 Ensuring Chrome Headless Shell is available...');
|
|
||||||
await ensureBrowser();
|
|
||||||
console.log('✅ Chrome Headless Shell ready');
|
|
||||||
} catch (err) {
|
|
||||||
console.warn('⚠️ Failed to pre-download browser (renders may download on first use):', err);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ═══ App Lifecycle ═══
|
// ═══ App Lifecycle ═══
|
||||||
|
|
||||||
@@ -305,11 +269,11 @@ app.whenReady().then(async () => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4. Create the main window
|
// 4. Set BRADLY_SERVE_URL for the renderer to find the app
|
||||||
createWindow();
|
process.env.BRADLY_SERVE_URL = `http://127.0.0.1:${expressPort}`;
|
||||||
|
|
||||||
// 5. Pre-download Chrome Headless Shell in background
|
// 5. Create the main window
|
||||||
predownloadBrowser();
|
createWindow();
|
||||||
|
|
||||||
// macOS: re-create window when dock icon is clicked
|
// macOS: re-create window when dock icon is clicked
|
||||||
app.on('activate', () => {
|
app.on('activate', () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user