JSFiddle - React, Tailwind, and code Playground
HTML
<div data-role="page">
<div id="radioContent">
<div data-role="content">
<a data-role="button" onclick="RadioListenLive()">
<div id="radiotext">Listen Live</div>
</a>
</div>
</div>
</div>
JavaScript
var radioStream = new Audio('http://yp.shoutcast.com/sbin/tunein-station.pls?id=496891');
var radioPlaying = false;
function RadioListenLive()
{
try
{
if (radioPlaying)
{
radioStream.pause();
document.getElementById("radiotext").innerHTML = "Listen Live";
radioPlaying = false;
}
else
{
radioStream.play();
document.getElementById("radiotext").innerHTML = "Click to pause";
radioPlaying = true;
}
}
catch (e)
{
alert(e.message);
}
}