From ebd275fb81c7998339ac03d6d1d24e77fbc6fb6f Mon Sep 17 00:00:00 2001 From: Anirudh Sevugan Date: Sun, 23 Feb 2025 16:00:50 +0530 Subject: [PATCH] Update renderer.js --- simpliplay/renderer.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/simpliplay/renderer.js b/simpliplay/renderer.js index 52f7aa4..444e577 100644 --- a/simpliplay/renderer.js +++ b/simpliplay/renderer.js @@ -3,15 +3,18 @@ window.electron.receive("play-media", (filePath) => { loadMedia(filePath); }); -// Function to load and play media file function loadMedia(filePath) { dialogOverlay.style.display = 'none'; const mediaElement = document.getElementById("mediaPlayer"); if (mediaElement) { - mediaElement.src = `file://${filePath}`; // ✅ Convert file path to a valid URL + // Encode special characters in the file path + const encodedFilePath = encodeURI(`file://${filePath}`); + + mediaElement.src = encodedFilePath; // ✅ Use encoded file path if (autoplayCheckbox && autoplayCheckbox.checked) { mediaElement.play(); } } } +