From e13c65b1e7d6180f034c9e352ce2e04c3f8aeac6 Mon Sep 17 00:00:00 2001 From: Anirudh Sevugan Date: Sun, 23 Feb 2025 16:03:34 +0530 Subject: [PATCH] Update renderer.js --- simpliplay/renderer.js | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/simpliplay/renderer.js b/simpliplay/renderer.js index 444e577..5e6f1db 100644 --- a/simpliplay/renderer.js +++ b/simpliplay/renderer.js @@ -1,20 +1,16 @@ -// Listen for media file path from main process -window.electron.receive("play-media", (filePath) => { - loadMedia(filePath); +// Listen for media file URL from main process +window.electron.receive("play-media", (fileURL) => { + loadMedia(fileURL); }); -function loadMedia(filePath) { +function loadMedia(fileURL) { dialogOverlay.style.display = 'none'; const mediaElement = document.getElementById("mediaPlayer"); - if (mediaElement) { - // Encode special characters in the file path - const encodedFilePath = encodeURI(`file://${filePath}`); - mediaElement.src = encodedFilePath; // ✅ Use encoded file path + if (mediaElement) { + mediaElement.src = fileURL; // ✅ Safe, properly encoded URL if (autoplayCheckbox && autoplayCheckbox.checked) { mediaElement.play(); } } } - -