Skip to content

Create polished demo videos without editing skills. Mac/Windows/Linux

feat: add handlers + preloads

4rjunc530485c67a7a
diff --git a/electron/ipc/handlers.ts b/electron/ipc/handlers.ts
index 4228ab21..43ed80d9 100644
--- a/electron/ipc/handlers.ts
+++ b/electron/ipc/handlers.ts
@@ -2471,6 +2471,35 @@ export function registerIpcHandlers(
}
});
+ ipcMain.handle('open-audio-file-picker', async () => {
+ try {
+ const result = await dialog.showOpenDialog({
+ title: 'Select Audio File',
+ filters: [
+ { name: 'Audio Files', extensions: ['mp3', 'wav', 'aac', 'm4a', 'flac', 'ogg'] },
+ { name: 'All Files', extensions: ['*'] }
+ ],
+ properties: ['openFile']
+ });
+
+ if (result.canceled || result.filePaths.length === 0) {
+ return { success: false, canceled: true };
+ }
+
+ return {
+ success: true,
+ path: result.filePaths[0]
+ };
+ } catch (error) {
+ console.error('Failed to open audio file picker:', error);
+ return {
+ success: false,
+ message: 'Failed to open audio file picker',
+ error: String(error)
+ };
+ }
+ });
+
ipcMain.handle('reveal-in-folder', async (_, filePath: string) => {
try {
// shell.showItemInFolder doesn't return a value, it throws on error
diff --git a/electron/preload.ts b/electron/preload.ts
index ebc4fed1..b98420a9 100644
--- a/electron/preload.ts
+++ b/electron/preload.ts
@@ -113,6 +113,9 @@ contextBridge.exposeInMainWorld('electronAPI', {
openVideoFilePicker: () => {
return ipcRenderer.invoke('open-video-file-picker')
},
+ openAudioFilePicker: () => {
+ return ipcRenderer.invoke('open-audio-file-picker')
+ },
setCurrentVideoPath: (path: string) => {
return ipcRenderer.invoke('set-current-video-path', path)
},