diff --git a/electron/main/preload.js b/electron/main/preload.js index 80eecb8..ec7ff05 100644 --- a/electron/main/preload.js +++ b/electron/main/preload.js @@ -9,6 +9,9 @@ try { contextBridge.exposeInMainWorld("extractor", { extract: (file) => ipcRenderer.send("extract", file) }) + contextBridge.exposeInMainWorld("electronAPI", { + getFilePath: (file) => {return webUtils.getPathForFile(file)} + }) } catch (error) { console.log("Error in preload.js"); } diff --git a/electron/main/script.js b/electron/main/script.js index 244b557..b947cdb 100644 --- a/electron/main/script.js +++ b/electron/main/script.js @@ -23,7 +23,7 @@ function checkBoxes() { if(isChecked){ //Code to submit the video - var pathTest = fileName.textContent + ""; + var pathTest = window.electronAPI.getFilePath(videoUpload.files[0]); if(pathTest.endsWith(".mp4") || holdy.endsWith(".mov") || holdy.endsWith(".avi") || holdy.endsWith( ".mkv")){ window.extractor.extract({inputVideoPath: pathTest, outputType:"wav"}) } @@ -32,7 +32,7 @@ function checkBoxes() { alert('Please select at least one document type.'); } } catch (error) { - console.log("Error") + console.log(error) } // mapFunctions.get("extraction-video-to-audio").function({inputVideoPath:"./a.mp4", outputType:"wav"})