building a browser-based music player

I have a large digitized music collection on my local QNap NAS, but I hardly ever listen to any of it anymore. For some reason I find most music players buggy, slow or just too restricted. Furthermore, just a player isn’t enough if your music is on a remote server - you need to mess with exported filesystems (slow), daap (restricted), or overly complex servers like mpd and gnump3d with special clients.

All I want is to listen to my collection of mp3 and ogg music files from different locations / different operating systems.

Some of the issues I’ve had:

  • iTunes / daap is too restricted. You can’t even make playlists. Also, it’s (witouth hacks) not accessible from outside of your home network. It sucks on both client and server.
  • Conversion. I have a lot of OGG encoded music, and only a few players support this out of the box. This means you need to do realtime conversion of content or install plugins into your player(s).
  • Buggy / slow / limited music players. Songbird is probably the worst. Most music players only work well on local data.
  • Server software. You need to make the music available externally. nfs/samba sharing usually isn’t an option, streaming servers are overkill (and often don’t seem to work properly, or have ogg issues, etc). gnump3d and mpd require special support in your player and are rather complex (but primitive in usability).
  • mp3tunes.com comes close to what I want - online storage with a player in your browser. But uploading music is rather hard and I already have my music online elsewhere.

But how hard can all this be? What I want boils down to:

  • All music on a single, externally accessible location (i.e. my home NAS)
  • Support for different platforms (Linux, OSX, possibly Windows. Perhaps even Android!)
  • Support for mp3 and ogg.
  • Some sort of playlist support.

html5 and rctk to the rescue!

Then it came to me. HTML5 plays embedded audio. Chrome actually supports both mp3 and ogg. All I need is a convenient way to make selections/playlists in a browser. And that’s what RCTK is perfect for!

RCTK?

Yeah. That’s been my pet project for the last year. You can read all about it on the RCTK Google Code Project Page. Basically, it’s a different kind of web toolkit. Not stateless page/rpc/form-based like most web frameworks, but widget based with long running stateful sessions/processes. This makes the implementation quite easy, with less than 200 lines of code you have a pretty functional player that supports:

  • Selecting files and directories into a playlist
  • Play/pause/next/continuous play
  • Explicitly selecting tracks to play
  • “smart” random play, looping

All you need from a trivial music player, available everywhere you have internet access. And best of all, it runs directly on my QNap NAS - it doesn’t have much dependencies and doesn’t require too much resources. If you have Python 2.4 or better (RCTK actually works on Python 3!), run a simple buildout script and you’re done!

This is what it looks like:

Sure, it doesn’t look very fancy, but it works for me. The overall styling, design and layout of RCTK needs work - it’s high on my priority list.

Last updated April 18, 2013, 4:35 p.m.
comments powered by Disqus