A radio player on your website: make it work every time
The player is the most important part of your radio website. If it doesn't work, you've lost the listener. These are the points where things often go wrong in practice, and how to fix them.
Use an https stream
If your website runs on https (and it should), browsers block a stream that runs over plain http. This is called mixed content. The player then stays silent without a clear error. Make sure your streaming server has an https address too. With most hosted panels such as AzuraCast this is standard.
Autoplay (usually) doesn't work
Browsers only allow sound to start after the visitor has clicked or tapped something. Playing automatically when the page opens is therefore blocked. So make the play button big and clear, so starting is a single tap.
Keep the music playing while people click
A listener who clicks through to the schedule or the news doesn't want the music to stop. You solve this with a player that keeps playing while navigating, or by letting the site work as a web app. Also read a radio app for your listeners.
Show what's playing now
The title, the artist and cover art bring your player to life. You get that data from your streaming panel. Also show the DJ's name when someone is live, and keep a list of recently played songs.
Controls on the lock screen
With the browser's Media Session feature, the title, cover art and buttons appear on the phone's lock screen and in the computer's media controls. Listeners can then pause without opening your site.
Reconnect after an interruption
Mobile connections sometimes drop for a moment, for example on the train. A good player notices this and reconnects by itself. If you have a backup stream, let the player switch to it when the main stream goes down.
Choose the right quality
A higher bitrate sounds better but costs listeners more mobile data and you more traffic. For most stations MP3 at 128 kbps or AAC at 64 to 96 kbps is a good choice. Explained in bitrate and format.
Make it accessible
- The button must work with the keyboard.
- Give the button a clear name for screen readers, such as "Listen live".
- Make sure there's enough contrast and a volume control that works on a small screen too.
Test on several devices
Test your player on an iPhone, an Android phone and a computer, in Safari, Chrome and Firefox. Also test with the screen locked and after switching between wifi and mobile data. What works in one browser can stay silent in another.
Frequently asked questions
Why won't my radio player play on my website?
Often the stream runs over http while your site is on https. Browsers block that. Use an https address for your stream.
Can my radio start playing automatically?
Usually not: browsers only allow sound after a click or tap by the visitor. So make the play button big and clear.