mirror of
https://github.com/A-Star100/simpliplay-desktop.git
synced 2025-09-18 06:39:44 +00:00
21 lines
603 B
JavaScript
21 lines
603 B
JavaScript
// Listen for media file URL from main process
|
|
window.electron.receive("play-media", (fileURL) => {
|
|
loadMedia(fileURL);
|
|
});
|
|
|
|
function loadMedia(fileURL) {
|
|
dialogOverlay.style.display = 'none';
|
|
const mediaElement = document.getElementById("mediaPlayer");
|
|
|
|
mediaElement.oncanplay = null;
|
|
|
|
if (mediaElement) {
|
|
mediaElement.src = fileURL; // ✅ Safe, properly encoded URL
|
|
mediaElement.oncanplay = () => {
|
|
if (autoplayCheckbox && autoplayCheckbox.checked) {
|
|
mediaElement.play().catch(error => console.warn("Playback issue:", error));
|
|
}
|
|
};
|
|
}
|
|
}
|