<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Reproductor de Audio RSS</title>
</head>
<body>
<audio controls id="audioPlayer">
Tu navegador no soporta la etiqueta de audio.
</audio>
<script>
document.addEventListener('DOMContentLoaded', function() {
const rssFeedUrl = "https://podcast.zenomedia.com/api/public/podcasts/19abc11b-c842-49ce-b427-e6e251312736/rss";
fetch(rssFeedUrl)
.then(response => response.text())
.then(xmlText => {
const parser = new DOMParser();
const xmlDoc = parser.parseFromString(xmlText, "text/xml");
const items = xmlDoc.querySelectorAll("item");
items.forEach(item => {
const title = item.querySelector("title").textContent;
const audioUrl = item.querySelector("enclosure").getAttribute("url");
const audioPlayer = document.getElementById('audioPlayer');
const source = document.createElement('source');
source.setAttribute('src', audioUrl);
source.setAttribute('type', 'audio/mpeg');
source.setAttribute('title', title);
audioPlayer.appendChild(source);
});
})
.catch(error => console.error('Error fetching RSS feed:', error));
});
</script>
</body>
</html>