I'd like to embed simple audio player on my webpage and I want it to get the audio from a stream broadcasted from my server. I read I can use IceCast on my web-server, getting an audio stream from a client using IceS (or this is what i got from other questions and articles) but once I have my stream, IceCast is supposed to broadcast it on an URL, that can be opened from pkayers like winamp or similar. I've found out this is quite a rare topic, usually people just want to broadcast "radio" where files are taken from a static playlist. In this case I have to get a stream from an IceCast URL and embed it with a player on a web page. Thank.
2 Answers
This is quite straightforward actually. I think if you search around for "SHOUTcast" instead, you will find a lot more out there.
SHOUTcast/IceCast use a protocol that is (nearly) compatible with HTTP. Therefore, (most) any player that can play MP3 streaming over HTTP is capable of playing a SHOUTcast compatible stream.
You will find that there are many Flash players for this sort of thing.
One thing I should point out though. If you are using Flash, use a Flash player that is actually designed to work with internet radio. The reason for this is that older versions of Flash would download all of the audio into memory for playing back later. This was because they were originally designed for a minute or two of looping background music for some game, and it would save it in memory to be played again. With Internet Radio, we of course won't be playing the start of the program again, and want to discard that. With ActionScript 3 and later (and with some hacks in AS2), this is possible, and many of the players now take advantage of the stream-it-and-forget-it methods.
- 252
- 1
- 8
There was a time when soundcast/icecast worked, somewhat. But with flash being very limited with device compatibility I ditched both years ago.
2 things to consider when streaming..listeners for the most part can not rewind or forward which is a very outdated concept. On demand is where it is at, unless you have a live Q and A, I do not see a need for live streams.
With that, you can use Google drive (free up to 15 gigs storage), to store all audio files. Just make sure the files are made public. Simply add the links to your site and voila, when clicked, it starts streaming. For downloading, just wrap your link like so:
<a href="URL GOES HERE" download>.
Providing a streaming/download link compared to embedding. If embedded a user is forced to stay on the site, when a link is provided they can open it with an audio app they choose. Think user experience as well as your needs.
To properly embed audio files that is compatible for almost all devices and browsers go with HTML5, and that code is as follows:
<audio controls>
<source src="URL.ogg" type="audio/ogg">
<source src="URL.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
- 2,400
- 10
- 11