Showing posts with label apple. Show all posts
Showing posts with label apple. Show all posts

Monday, November 15, 2010

Streaming music from Squeezebox Server to an iOS device

A few years ago, I noticed that it was not possible to stream music from Squeezebox Server (previously called SlimServer, then SqueezeCenter) to an iPod Touch. Fortunately, things have changed: bugs have been fixed and iOS 4 now supports multitasking (since June 2010). A few weeks ago, I reinstalled Squeezebox Server on my Ubuntu server and realized that it was finally possible to use my iPhone to play music from my server. Here’s how I currently do it:
  1. Start Safari on your iPhone
  2. Enter the following URL: http://myserver:9000/stream.mp3 (or http://user:password@myserver:9000/stream.mp3, but this is less secure and will cause Safari to display a warning message)
  3. Start iPeng (a remote control application for Squeezebox Server) or any other equivalent application
  4. Add tracks to the player matching your iPhone and play them
I don’t know if it’s the optimal way to do it or not, so any hints or suggestions will be appreciated. In my experience, the main drawback of this method is that Safari buffers a lot of audio before playing it, so expect a long delay (15-30 seconds) when playing a new track. Also, you won’t be able to use Safari to access any other sites. I guess a dedicated streaming client (instead of Safari Mobile) could help, but I don’t know if such an application even exists.

Update (November 27, 2010). There's a streaming client called OPlayer Lite that, according to my experience, buffers about half as much audio as Safari Mobile. I've also just discovered another application called Squeezecast, but it's not free (it's $5.99, which sounds expensive as it apparently still requires iPeng to manage the playlists). Does anybody have any experience with it?

Another "trick" that I'm now using is to connect from my iPhone using the following URL:

http://user:password@myserver:9000/stream.mp3?name=Olivier%27s+iPhone&bitrate=160

The "bitrate" parameter in the URL forces the bitrate to the specified value if the player doesn't exist yet (so you don't have to change it in the settings). The "name" parameter is the name of the player to use or create. That way, your iPhone won't create a new player every time your IP address changes. Unfortunately, that feature is still not supported in Squeezebox Server. There's a feature request for that on bugs.slimdevices.com that has been open since 2005! The good news is that it's pretty straightfoward to patch Squeezebox Server. In the processURL function in Slim/Web/HTTP.pm, add the following lines:

if ($params->{'name'}) {
  $address = $params->{'name'};
  main::INFOLOG && $log->is_info && $log->info("processURL using address=$address");

}

just before:

$client = Slim::Player::Client::getClient($address);


and the following lines:

if ($params->{'name'}) {
  $client->name($params->{'name'});

}

just after:

if ( $params->{userAgent} ) {
  ...
  $client->name( $agent . ' ' . string('FROM') . ' ' . $address );

}

Update (February 9, 2011). iPeng now supports playback (i.e. it can act as a Squeezbox player without any third-party application). The feature is not free (it is available as an in app purchase), but, according to my tests, it is well worth the price ($4.99).

Sunday, December 16, 2007

Apple iPhone / iPod Touch as SlimServer clients

There's almost a consensus about what's missing on the iPhone: support for 3G (or better), a GPS, a video capture feature, support for third-party applications, etc. These are the most obvious features, because we're used (or almost used) to having them on other phones.

The other day, I was playing with my father's brand new 16-GB iPod Touch. Just like the iPhone, you can use it to browse the Web using Safari. The difference with the iPhone is that you necessarily have to connect to a Wi-Fi network. You cannot connect to an EDGE network (i.e. to a mobile phone network). Anyway, I'm a fan of SlimServer. It's not the greatest piece of software I've ever seen, but I use it to listen to my music collection remotely, via the Internet, from at least four different locations. The rest of the time (maybe 5-10% of the time), I use my old first-generation iPod. So, quite naturally, I tried to connect to my PC, using the iPod Touch. Of course, it worked: I was able to browse my music collection, launch search queries, and so on. The only thing I couldn't do was actually listen to my music!

This is the number one feature I'd like to see on the iPhone and/or iPod Touch: support for music streaming via HTTP. After all, they have everything that's needed to do it. This shouldn't be too hard to implement...