I've been trying to find a good solution to playing Shoutcast/Icecast MP3 radio streams through Chrome and a Chromecast. I've found a few players such as Jplayer, dabble.me, tunein.com and dug into the players provided by the big radio stations such as SomaFM. This has also led me to look at other sources of mp3 streams such as Logitech Media Server. It seems that while people used to use Flash, all the current players use the HTML5 <audio> tag. And even JPlayer is just a wrapper around this tag. This tag is also used in the Chromecast SDK for their default and styleable media players when passed an mp3 stream.
I'm hitting a couple of problems that seem to be shared by both <audio> in Chrome and in the Chromecast media players.
1. The audio tag tries really hard to buffer the whole mp3. If it's handed a file this makes a kind of sense and there is a parameter (preload) to control whether to just start playing or to buffer a substantial amount first. However a stream isn't a fixed length file so this makes no sense. And what happens is that it seems to try and buffer at least 70s of audio. This means that track changes or muting the stream doesn't take effect in the output for 70s or longer later after the event. The buffering shouldn't really be more than a couple of seconds, just enough to cover up short drop outs in connectivity.
2. Although mp3 streams tend to have metadata embedded about the track, album, artist and even album art, neither the Chrome html5 tag nor the Chromecast make any attempt to read and display this data. The data typically gets embedded in the first few frames after a change of source track. So you'd hope there would be some kind of javascript event kicked out when this happens, but nothing. Dedicated players like Winamp, Windows Media Player, iTunes, VLC generally have no problem displaying it.
There are huge numbers of internet radio stations out there using Shoutcast, Icecast and so on. I feel like Chromecast really needs to have a good solution to playing them and at the moment it doesn't. And this will become more important when hardware supporting Cast for Audio starts to appear.
I've even thought of trying to program some of this myself, but at the moment I can't see any way without getting really low level with Web Audio API and even with that I'm not sure its possible. It would be so much easier if the <audio> tag implementation was just a bit better at handling mp3 streams.