Update renderer.js

This commit is contained in:
Anirudh Sevugan 2025-02-21 19:50:13 +05:30 committed by GitHub
parent 298e0b19fe
commit f46010710b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -0,0 +1,17 @@
// Listen for media file path from main process
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
if (autoplayCheckbox && autoplayCheckbox.checked) {
mediaElement.play();
}
}
}