Audio Tag for Music Streams
The audio
tag can be used to listen to live audio streams directly from the source. Putting the tag on your own web page makes it available from any device or computer with a browser.
All audio stream websites I've seen (music streams, mostly) offer a browser-based app to listen to their music. But there is one drawback to that, you have to change web pages if you want to listen to another site's stream.
With your own web page, it can have an audio
tag for every one of your favorite streams. There is no need to send your browser to a different web page.
With more than one audio tag on your own web page, and one already playing, 2 clicks changes the stream.
-
Tap the "stop" icon of the stream you want to stop.
-
Tap the "start" icon of the new stream.
(If you start a new stream without stopping the other, you'll hear both streams.)
Here is an audio
tag to play music from Easy Hits Florida, a classic rock music stream.
Here is the source code for the above Easy Hits Florida stream audio tag.
<audio controls src="https://das-edge11-live365-dal03.cdnstream.com/a80304"></audio>
To listen to a different stream, change the src
value to the new stream's URL.
How to Get Audio Stream URLs
Some audio streaming websites provide their stream URLs, in addition to their app. For others, it may work to use the browser's "view source code" menu item to find the audio
tag and copy the src
URL.
The streamurl.link/ website can be used to help find streaming URLs you can't locate on the stream-source websites. (Their "Stream URL" icon puts the URL onto your clipboard ready for pasting.) Caveat: Many of their audio stream URLs point to locations no longer available. Test the URLs.
Another way is to use an AI chat bot to find streaming URLs. A prompt something like "provide the audio-stream URL for WCRB 99.5 radio station to use in an HTML audio tag's src value
" might work. This also comes with the caveat that URLs provided by the AI might no longer be available.
Of course, a person could do the obvious, use the website's contact form and ask for the URL.
Making Your Own Audio Streams Web Page
In essence, this is a regular web page. The content of the web page is an audio
tag for each of your favorite streams. For clarity, the name of each stream can be published with its audio
tag.
Consider putting your web page at a location with an HTTP URL instead of HTTPS. The reason is so you have a larger selection of streams to choose from. Some audio stream URLs have only HTTP URLs. The browser might complain if you put an audio
tag with an HTTP URL on an HTTPS page.
Others may find your web page of audio streams. If they listen to the streams, the resources are provided by their browser and the stream source server, not by your server. In other words, the audio streams do not go through your server.
If your audio streams web page contains confidential information, it may be prudent to put it in an access-restricted directory.
Most of the music I listen to while I am working is through my own web page of audio tags. It's quick and simple to change stations whenever I feel like it.
Now you know how to make your own.
(This content first appeared in Possibilities newsletter.)
Will Bontrager