Start SqueezePlayer on Startup

May 25th, 2013 14 Comments »

Some people are requesting me to provide an option to start SqueezePlayer automatically on startup.

Well actually this is already possible now as Android is a very cool an open platform, so I decided to write a small tutorial about how to achieve what you want.

The easy way “Automate It”

There is a very cool (free) application on the store called “AutomateIt” .
It allows you to automate almost everything on your devices – and this also includes automatically starting Apps at boot time.

There are several other Apps on the store allowing similar things, but AutomateIt beats them all, as it is sooo intuitive, one cannot believe it.

So just start this App, and tap “Add New Rule”. You are asked for a “trigger” where you just need to choose the autostart trigger.
The App then asks you for an “Action”, where you choose the “Start App” action. You will be presented a list of Apps and SqueezePlayer will be among them.

Final step is giving your new Rule a name – called it whatever makes sense to you, DONE !

Well now this was the easy part – be warned – the next two hours you will play with all the other features of AutomateIt.

This solution has one caveat though: The SqueezePlayer App main screen will be visible after you boot …

More Advanced “Tasker”

Tasker is an App like AutomateIt. Looks more clunky, but is much more powerful. It also costs a little bit, but if you want to get rid of the main screen of SqueezePlayer after booting up, I’m not aware of another possibility right now.

The steps are actually the same: we will need to configure a trigger (i.e. “at boot”) and an action/task (i.e. “start SqueezePlayer”).
As the action, please choose “Misc -> Send Intent”. We will use this one to automatically start SqueezePlayers hidden service (opposed to the mainscreen).
Such Intents do have a lot of field, you only need a few:
Package: de.bluegaspode.squeezeplayer
Class: de.bluegaspode.squeezeplayer.playback.service.PlaybackService
Target: Service

DONE!

Once you get the hang of it, it’s really to setup different things as well.
Some users for instance don’t like that SqueezePlayer shuts down after 15minutes on batteries. With Tasker you can send the Intent  every 10 minutes, SqueezePlayer resets it’s 15min shutdown timer then.

[3G Part 5] Secure your communication channel

May 25th, 2011 59 Comments »

If you followed all previous chapters you will have a rock solid remote streaming solution ready by now. Congratulations!

Now lets start to talk a bit about security and then you will need to decide, if you want to go on.
The following steps and considerations are optional (but probably worth it).

Our current solution has two possible flaws:

  • your username and password is sent over the internet unencrypted. If someone can catch your wireless traffic (maybe your are using a public hotspot sometimes?), analyses the traffic and extracts the username/password (can be done with automated scripts very easily) he is able to log in into your Squeezebox Server as well and change your settings or remote control your other Squeezeboxes.
    Even worse: if you were lazy and used the same credentials as your Facebook or email account, well … I guess I don’t need to write on 😉
  • Your Squeezebox Server is accessible from the internet to anyone. There is some tiny possibility someone can hack into this Squeezebox software and might take over your server.

Why might anyone want to hack your server you might ask?
Definitely not for controlling your Squeezeboxes I’d say – but there are many people out there that want to setup some new servers to send spam or do other illegal stuff.

How can we protect against this?

There are two common techniques to create a much more secure channel. One is called ‘OpenVPN’ – some routers support that and your mobile might be able to create a secure ‘tunnel’ through the internet to your router. Due to it’s complexity I won’t go into further details here, Google will be your friend.

Another possibility is to create a ‘SSH-tunnel’. SSH is a technique to connect via an encrypted channel to your server. If you are using a Linux based NAS or server you might already have used it to log in into your server (if you ever used the tool ‘Putty’ on Windows, you are on the right track … )

The good thing about SSH – it can also forward specified ports, which is perfect for our needs.
So from now on I expect you to have a server where you can already login with SSH.

  • Update your port forwarding in your router. SSH uses TCP port 22. Any connection from the internet to this port should be forwarded to your Squeezebox-Server.
    You can delete the port forwards  9000 and 3483 on your router, we won’t need them anymore.
    These were insecure so let’s get rid of of them. 

    Is  SSH on port 22 more secure than Squeezebox-Server on port 9000+3483 you might ask?
    And the answer is: definitely – thousands of administrators around the world use SSH around the clock to remotely connect to their respective servers 🙂

  • Download an App that can create a SSH tunnel with port forwarding.
    Um, well.The only viable option on the market ‘connectbot’ has a bug so it sort of works with Squeezebox-Server but has it’s issues. This issue with ConnectBot seems to be resolved on Honeycomb by the way, but on Android devices below tracks in a playlist are not advancing, when a song is finished.
  • Even better might be SSH AutoTunnel and one user reported succes with it in the comments section. It might suffer from the same problems as ConnectBot on pre Honeycomb Android devices (though this has not been verified yet). I’d go with this App first!

    Both ConnectBot and SSH AutoTunnel allow you to connect to your SSH server first. Try if you get a connection. After it has been established within Connectbot or SSH AutoTunnel do configure port forwardings for port 9000 and 3483 before trying with SqueezePlayer (read below what to do in SqueezePlayer).

  • Another option ‘SSHTunnel (Beta)’ only allows a single port to be forwarded (and we need two).That’s why I wrote my own App ‘SqueezeTunnel’ to care for all the common Squeezebox-SSH-Stuff. You can download it here.  Attention: your Android device needs to be rooted, for this tool to work (it comes with it’s own SSH client and wants to install it). Also this App is a quick hack/port of SSHTunnel and most of the SSH related code from the original I don’t understand 🙂
    As SqueezeTunnel is a fork of the ‘SSHTunnel’ project protected by the GPLv3 license, you can have a look at the source-code of SqueezeTunnel here.

Here is what you need to configure in SqueezeTunnel once you installed it.

  • Host: your dyndns URL (see Part 1 for details) i.e. wow-my-server.dyndns.org
    Via this URL SqueezeTunnel is able to find your router and create the tunnel.
  • Port: 22 is the default port for SSH
  • User/Password: your username/password to login with SSH. This is NOT the username/password you entered in the Squeezebox-Server web-interface. It’s rather the username/password you need to enter, when you connect to your server via SSH.
  • Squeezebox-Server Port: typically 9000. But you can change it in case it’s different in your setup.

Now try to create the tunnel with the topmost item ‘Enable/Disable SSH Tunnel’, you should get a new icon in the status bar, hopefully saying ‘connected’.

Now we need to configure SqueezePlayer to use the tunnel.
As the server-address in the SqueezePlayer settings just use ‘localhost’ instead of the DynDNS-URL we used before.

Yes this might sound strange – but the tunnel starts directly on your the AndroidPhone so we don’t need to look elsewhere this time. SqueezeTunnel which should still be running in the background will then take care of the correct encrypted routing through the internet to your Squeezebox-Server.

By the way: you can remove the username/password in the Squeezebox-Server settings now. They won’t give us any more security, the username/password used to establish the SSH connection are much much better and secure.

I really hope this last chapter was not too complicated to understand and you could get great inspiration about making your remote streaming very secure.

[3G Part 4] Reduce the bandwidth to get robust streaming

May 24th, 2011 2 Comments »

So your first test with streaming are working after you finished Part 3, ey?
Or do you face buffering issues already?

Let’s look at the last missing piece for a good setup!

All your music needs to travel back trough the internet from your Squeezebox-Server to your mobile or tablet.

First hurdle is your Internet Service Provider: Did you ever notice that sending a mail with a lot of pictures takes MUCH more time than to download the same amount of data?
For instance if I buy “DSL 6.000” from one of our German providers, I get ‘up to’ 6.000kBit/s downstream (i.e inbound) traffic, but they guarantee only ‘up to’ (haha) 576kBit/s upstream (outbound) traffic.

And that’s where your music wants to pass. Good enough for mp3, but a 44/16 FLAC is having much more bits.

Second hurdle: your mobile carrier. With different technologies (GPRS, EDGE, 3G, HSDPA) you get different speed – from as bad as 56kBit/s up to 56MBit/s.

How to cope with this?
Fortunately Squeezebox-Server is an awesome beast and can help us with it’s option ‘bitrate limiting’. If you activate that, the Server will transcode your music on the fly to your desired bitrate – doesn’t matter if it’s FLAC or high quality mp3s => you music gets crunched to whatever can go through your wires.
This can be activated only for SqueezePlayer, so the streaming to your other Squeezeboxes is unaffected.

To find this option, enter the web-interface of the Squeezebox-Server, open the settings page and move to the players audio settings:

For this to work you need to install the LAME encoder on your server.

Now the bad news: if you are running the Squeezebox server on lower CPU device (e.g. a NAS or SheevaPlug), the LAME plugin will not be fast enough to convert your files to the desired bitrate.

On the Squeezebox-Wiki you can instructions about how to install a much faster transcoder: Shine for Transcoding.

[3G Part 3] Secure your server

May 20th, 2011 Comments Off on [3G Part 3] Secure your server

In Part 2 you configured your router so that it will route outbound traffic to your Squeezebox-Server.

This is very nice as you can now stream music BUT: anyone else will be able to do so as well.
Even worse: via port 9000 anyone can remote control your Squeezebox Server.

So don’t get annoyed when someone starts your music in the middle of the night 😉

Weeeelllll …

OK

Not so nice.

Let’s do something then, that this will not happen!

I’m sure you know that your Squeezebox server has a web-interface? And that there is a huuuuge settings screen? And that you can enable password protection there?

If you never saw it – you will find it under ‘Advanced -> Security’:

PLEASE – use a username and password that is unique (NOT your GMail, Facebook or Twitter account).
This username and password will be transferred unencrypted through the internet 🙁 – so there is a possibility someone else will catch it.

I’m not very happy Logitech calls this page ‘Security’ because my definition of security is a bit different – but well … this type of protection is better than nothing at least! We will take care of better security in Part 5 – then we can turn off the Squeezebox-Server ‘security’ again, as it’s not needed anymore.

All your Squeezeboxes will ask you for username and password of course now (just enter them once).
Also SqueezePlayer wants you to configure username and password on it’s setting page, so don’t forget to enter them there!

Next step is to care about bandwidth limiting in Part 4.

 

[3G Part 2] Make your router forward traffic to your Squeezebox-Server

May 20th, 2011 6 Comments »

Part 1 showed you how to make SqueezePlayer knock on the doors of your router. Unfortunately routers are very picky: typically noone is allowed to get in, as the main task of routers is to protect your Home Network from the Big Bad Internet.

That’s why we need to tell your router:

– it should allow SqueezePlayers traffic to come in
– and route it directly to your Squeezebox Server

If you read the first part you might remember me talking about moving targets.
Also the Squeezebox-Servers IP address is changing in most setups. Typically not very fast, but once a month or on a restart it’s not uncommon with some routers.

So let’s cope with this first!
All modern routers are able to assign static (i.e. never changing) IP addresses to the devices of your network – if you just tell them.

The magic word you have to search for on your routers web interface is ‘DHCP reservation’. Here you can enter devices and configure their static IP. When this is done it might look similar like on my router:

You see I have some more devices on my network. This table is actually very easy to read.
A device  is typically identified by it’s ‘MAC address’ – and then the router is just told what IP address to give this device.

Where to get these values from?
The MAC address of your Squeezebox-Server is the hardest. But there are good tutorials out there and I love this one as it has a lot of screenshots.
As IP just take the one your server is having right now: if you have connected SqueezePlayer via WiFi it will show you the IP in the ‘server’ field.

Now that your router is always having the same address, here comes the easy part: tell your router to forward all traffic from an outside SqueezePlayer to your server.

Search the webpages of your router until your find a section ‘Port Forwarding’.
You need to forward port 9000 and 3483 (both TCP) to the IP of your server.

Typically this is done by configuring two rules on your router, here is how the page looks on my router as a reference:

Done!

If you did everything right, SqueezePlayer should now be showing ‘Connected’ when using 3G.
Also mp3s should be playing fine already – if you have a FLAC library we need to do some more steps.

Please continue reading Part 3. We opened your Network to the outside world – and you should setup at least the bare minimum of security!

[3G Part 1] Make SqueezePlayer find your router

May 19th, 2011 32 Comments »

One of the first things to do is to make SqueezePlayer connect back to your network.

Whenever your router connects to the internet, unfortunately every time it get’s assigned a new IP address by your Internet Service Provider (ISP).
So effectively your home network is a moving target from the perspective of SqueezePlayer – let’s find a way to pin it down!

The standard solution to our problem is to use a service (like DynDNS.com – must be supported by your router, there are others) that gives you a static name on the internet. When your register there (DynDNS is not free anymore, try no-ip.com instead) you can choose a name, which will be your own unique address on the internet, like ‘wow-my-server.dyndns.com’

Now your router works together with this service: everytime it get’s a new IP address signed, it tells this service ‘hello – did you know – you find me HERE’ …
And when you then call the address ‘wow-my-server.dyndns.com’ you get routed back to your home.

It’s like in real live when the kid says to mummy ‘if daddy asks, please tell him I’m at [put in some place]’.
Always on the run, but when well trained (almost) always easily findable.

Clever ey?

So let’s set this up on your router – it needs to tell DynDNS.com where it can be found on the internet. Unfortunately this is highly dependent on your router, click through all it’s menus until you see the words ‘Dynamic DNS’ or ‘Dyndns.org’.

To give you a clue – here is how it looks on my DLINK router:

As you can see you have to choose what service do you want to use (there are others than DynDNS.org), your address you reserved with them and the username and password of your account over at DynDNS.org.

Phew … the final step of course is to tell SqueezePlayer this new address as well.

On the settings screen under the option ‘Squeezebox Server’ choose ‘manually enter address’ and in the new option ‘Manual Server Address’ enter the new name of your home: ‘wow-my-server.dyndns.com’.

We are finished now with your first step: SqueezePlayer will now find your router through the internet, yeah!

If you don’t want to give up yet … follow me in Part 2.

[3G Overview] How to connect SqueezePlayer via 3G

May 18th, 2011 64 Comments »

Via WiFi SqueezePlayer directly connects to your router which is connected to the Squeezebox server.
This is a rather simple setup, but still very versatile as you can walk around with your phone or tablet anywhere you are in reach of your own WiFi network.

But what about listening to your music in your car, at work, at college or school?
Well just connect via your mobile connection, but …

alas – now it looks much more complicated!

As you can see, your music needs to travel a long way now (through something call ‘THE NET’) and there are some obstacles to be cared of.

This multipart tutorial will help you to get things set up, but here is the short version.
If anything is not clear to you: follow the links to read an indepth tutorial about each needed step.

Part 1: Make SqueezePlayer find your home network
Typically you need to setup a service like DynDns.org on your router, so that it tells this service where it can be found on the internet. In SqueezePlayer you can then configure a name like ‘myserver.dyndns.org’.
You will also need to tell your Controller App (i.e. SqueezeCommander) this new address.

Part 2: Make your router forward traffic to your Squeezebox-Server
SqueezePlayer wants to talks on ports 3483 and 9000 with your server. Make your router forward these ports.

Part 3: Secure your server

Activate Password protection in your server, otherwise anyone on the internet is able to control your Squeezeboxes

Part 4: Reduce the bandwidth to get robust streaming.

Typically DSL doesn’t have good upstream capabilities. Squeezebox-Server allows you to setup bitrate limiting, so any song will be transcoded to an appropiate mp3 stream that will make it’s way from your network through the internet to your Android device.

Part 5: Secure your communication channel

Think about setting up a virtual private network, to make your setup even more secure.
Another option is to setup a SSH tunnel (also called ‘poor mans VPN’)  which we will do in the final chapter.