In-Game SHOUTcast Radio Player
A web-based SHOUTcast radio station directory and player that works in the Steam Community overlay, the in-game browser in Source engine games (the MOTD viewer), and any browser with support for Adobe Flash or Windows Media Player objects.
Important Note: If you just want to play some music on your own computer using the Steam Community overlay, you can use any website that plays music (Shoutcast.com, Pandora, etc.) in the game overlay's web browser. It is much more powerful than the browser in which Source displays the Message of the Day on servers.
Supports
-
Any game that can use the Steam Community overlay (almost all games in existence)
-
Any browser with support for Flash or Windows Media Player 7 (or higher) objects, depending on the version you choose.
-
Nintendo Wii (using the Flash version)
While it works in any game on an individual user basis, game server admins can also create easy shortcuts for their players in the following games:
-
Counter-Strike: Source (CS:S)
-
Team Fortress 2 (TF2)
-
Any Source engine game that can use the in-game browser
Features
-
In-game access to every SHOUTcast streaming radio station, over 50,000 stations in total (the same stations normally available in Winamp)
-
Fully searchable, by station title, genre, or song/program title
-
Browse by genre.
-
Remembers you between sessions and map changes, keeping track of:
-
Last station played, automatically resuming
-
Volume
-
Recent/favorite stations
Note: Due to updates in the game engine in 2010, the Source MOTD browser no longer stores cookies between game sessions, so this info will only be kept until the game is closed.
-
Lists stations in popularity order in all views
-
Completely customizable look. If you have a basic understanding of HTML and CSS, you should be able to make this look however you want it to. Knowing some PHP would help of course.
-
Low web server bandwidth usage: your server just has to grab and relay SHOUTcast's XML data.
-
No memory leaks in the Flash streaming mp3/SHOUTcast player. This only applies to the Flash version. The Windows Media version doesn't have that problem.
Screenshot
Demo
A fully functional web-based demo of each version, hosted here. Do not use these demos in your game server's web shortcuts or in your Steam profile (or link to them in any other fashion). These links will change on a regular basis. This isn't hard to host on your own server.
Flash version demo
Windows Media version demo
Requirements
Web Server
Game Server Mods (pick one)
Not required if you just want to use the radio on your computer via Steam.
-
SourceMod and the Web Shortcuts plugin
-
Mani Admin Plugin and the \cfg\mani_admin_plugin\webshortcutlist.txt file
-
BeetlesMod - Use addsaytrigger with the browse command in the \cfg\beetlesmod\defaults.cfg file
-
Any other mod that allows you to have a custom URL come up in response to a player typing a chat trigger
Web Browser
-
Support for either Flash or embedded Windows Media Player objects, depending on the version you choose.
-
Cookies must be enabled.
Download
-
Flash version, updated 2010-12-29
-
Works best in Source Engine MOTD (Message of the Day) viewer. Doesn't lag game.
-
Plays only MP3-based Shoutcast streams (Flash limitation)
-
Windows Media version, updated 2010-12-29
-
Causes Source Engine games to lag (at least when used in MOTD viewer as far as I've tested).
-
Supports all Shoutcast streams, not just MP3.
-
Doesn't fade out and back in every 80 seconds (the technique necessary to prevent Flash memory leaks)
-
Shows information about the currently playing song/program/station if the station provides this information
Instructions
For Individual Users
-
Extract/upload the contents of the .zip file to your web server.
-
By default, a directory called "radio" has been created. To run the radio, use the URL of that directory. For example, if you extracted the archive to the root of your web space, the URL will be like http://www.yoursite.com/radio .
-
Add the URL as a link on your Steam profile.
-
While in-game, hit Shift-Tab (the default combination) to bring up the Community overlay, click Community, click View my Profile, and click on the link you made to start the radio.
For Game Server Admins
-
Extract/upload the contents of the .zip file to your web server.
-
By default, a directory called "radio" has been created. To run the radio, use the URL of that directory. For example, if you extracted the archive to the root of your web space, the URL will be like http://www.yoursite.com/radio . Additionally, to allow your players to stop the stream in-game, there's a blank (black) HTML file at http://www.yoursite.com/radio/blank.html
-
Configure two chat triggers for your game server using a method described above, one that points to the main /radio url (radio and/or !radio for example), and one that points to the /radio/blank.html file (stop and/or !stop and/or radiooff and/or !radiooff) for example.
-
Give your users instructions on what the radio is and how to use it, either via your server's MOTD (message of the day), or via an announcements functionality in your admin plugin.
License and Code Info
You are authorized to do whatever you want with this code.
Note: I lost/deleted the Flash source file for the original Flash version of the player, but this blog describes the memory leak avoiding technique I used. It shouldn't be hard to make your own. If you look in the player.php file, you'll notice that the Flash MP3 Player can take a playTime parameter. This is the number of seconds a stream is played before a new instance of it is faded in and the old instance is faded out. This is 80 seconds by default. Setting this too high will cause people's games/browsers to crash; it depends on how much memory they have (or how much their browser has allotted to it).
Support
Email me. I can most likely help you out. Please attempt to use the instructions first, though.
Thanks
Rezz - Letting me know about Shoutcasts December 2010 change in their API URLs.