mirror of
https://github.com/A-Star100/simpliplay-desktop.git
synced 2025-09-17 22:29:38 +00:00
21 lines
584 B
JavaScript
21 lines
584 B
JavaScript
// Listen for media file path from main process
|
|
window.electron.receive("play-media", (filePath) => {
|
|
loadMedia(filePath);
|
|
});
|
|
|
|
function loadMedia(filePath) {
|
|
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 (autoplayCheckbox && autoplayCheckbox.checked) {
|
|
mediaElement.play();
|
|
}
|
|
}
|
|
}
|
|
|
|
|