Back to the knowledge base
Technical and reachability1 min read

Putting a player on your own website

Working HTML5 code you can paste straight in, no plugin.

You need no plugin to play your stream. Every modern browser can do it natively. This code works everywhere, including WordPress in an HTML block.

The simplest version

<audio controls preload="none">
  <source src="https://stream.centova.nl/yourstation" type="audio/mpeg">
  Your browser does not support audio.
</audio>

With your own listen button

<audio id="radio" preload="none">
  <source src="https://stream.centova.nl/yourstation" type="audio/mpeg">
</audio>
<button onclick="document.getElementById('radio').play()">
  Listen live
</button>

What to watch out for

  • Always use the https address, otherwise the browser blocks your player
  • Set preload to none, otherwise the stream starts loading before anyone clicks
  • Browsers do not allow autoplay with sound, there always has to be a click first

Want a nicer player with title display? Ask via a ticket and we will send you a fuller version that matches your branding.

Version with a now playing display

To also show what is playing, pull it from your server status. This example refreshes every fifteen seconds.

<div id="nowplaying">Loading</div>
<script>
setInterval(async () => {
  try {
    const r = await fetch("https://stream.centova.nl/status-json.xsl");
    const d = await r.json();
    document.getElementById("nowplaying").textContent =
      d.icestats.source.title || "Music";
  } catch (e) {}
}, 15000);
</script>

Placing it in WordPress

  1. 1Open the page or post in the block editor.
  2. 2Add a block and search for Custom HTML.
  3. 3Paste the code in.
  4. 4Click Preview to check the player appears.
  5. 5Publish the page.

Do not use a radio plugin if all you need is a player. The code above does the same, loads faster and does not break on a plugin update.

Still stuck?

Open a ticket and describe what you see. You get an answer from someone who works on the servers, usually within a few hours.

Open a ticket