A while ago, I wrote a simple media distribution system for use in Space Station 13, based on a very old and broken system by D2K5, designed to play remote media for all players in an area. The idea was to have player-interactable jukeboxes and radio stations. Most popular SS13 servers now use this system, and players have become familiar with muzak floating through the hallways while breaking open their friends’ heads with toolboxes.
However, this system relied upon Windows Media Player to deliver content to each player’s computer. The way it works is Windows Media Player is embedded into a simple webpage hidden in a skin element on each user’s GUI. When the server wants to play music, BYOND runs a JavaScript function that instructs WMP to play music from a URL at a certain volume and position.
function SetMusic(url, time, volume) { var player = document.getElementById('player'); player.URL = url; player.Controls.currentPosition = time; player.Settings.volume = volume; }
This worked fine for a while, but it was well understood that WMP wasn’t ideal: There’s several different versions of it out there, and the Javascript API wasn’t well documented or standardized. In addition, users on non-windows platforms were left out. I intended to switch to VLC at some point, but never got around to doing it.
Recently, a Windows update also updated WMP, and broke the JavaScript API we were using. Unfortunately, I had been burnt out of the SS13 community and decided to call it quits for a while. So, it smoldered for a while until I had some free time and decided to fix it.
VLC is a completely free and open-source media player with support for almost every format under the sun, including streams. Most players on SS13 use VLC or know of it, and it is also the only open-source media player I could find with a robust and documented JavaScript API for its embedded browser plugin. Therefore, I rewrote the client-side skin element to utilize it instead of WMP, and it works perfectly.
A pull request for VLC support on /vg/station is pending and awaiting approval.
Links
- VLC – http://www.videolan.org/
- Space Station 13