Part 2 – CustomisationThere are two separate issues here – using your own media streams, and customising the user interface (such as changing the buttons). Both of these are fairly straightforward, though, but they raise quite distinct issues – so I shall deal with them separately. You can have six stations and an off switch without having to make any significant changes to the code. If you want more stations than this, then you should probably read Part 3 of this HOWTO, and be prepared to hack the JavaScript!
Using your own media streams1. Finding suitable streamsBefore you do anything else, you need to find suitable streams. The easiest thing to do is to use a playlist site –
www.playlist.com is by far the best know, but there are others. You can also use many Internet radio stations. The important thing is that you need to be able to set up the stream so that it plays automatically on a single web page. Most sources that are designed to work with social network sites such as Myspace will do this, but subscription services that require you to log in will not. If you need to find Internet radio stations, then Google is your friend! There are many of them, but do be warned that a lot of them require you to log in.
2. Preparing code for playlistsCreate as many playlists as you like, and then use the playlist site to generate the HTML code. If you are using
www.playlist.com, then you need to follow the “Get Playlist Code” link on your home page, then select option E (“Get the code for any other social network, blog or your own personal website”). After choosing your playlist you will be given several options. The most important one is that autostart must be set to YES – otherwise it won’t work! You can also tell it whether or not you want a random shuffle here. Then press the “Get Code” button and save the code somewhere (e.g. cut and paste it into Windows Notepad).
3. Preparing code for radio stationsI am afraid I can’t give you step by step instructions here, because it varies depending upon the radio station. Some of them encourage you to use their radio station in any way you see fit – and provide instructions as to how to do this. Others, discourage or ban it and try to make this sort of thing as hard as possible. If you are interested in a station then read through their instructions. If they tell you how to embed the station into Myspace or a blog, then something similar should work here. However, it must be possible for the player to be set to autostart. If it doesn’t autostart, then it won’t work with the media centre.
4. Create web pages for the channelsOn your host, create a new web page for each channel. This should be a very simple HTML file that looks like this:
Code:<html>
<body>
<h1>Name of channel</h1>
<<< insert playlist or radio channel code here >>>
</body>
</html>
Just insert the name of the channel into the h1 tag (this is only used for testing – it doesn’t have any affect inside your zaby) and replace the <<< insert playlist or radio channel code here >>> line with the playlist code you have generated. Test these files – see if they will play in a web browser. Don’t go on to the next step until you hear your streams.
You should also have an “off” file so you can turn the thing off! You can use mine, or set up your own – it should just be empty, something like this:
Code:<html>
<body>
<h1>Media Not Playing</h1>
</body>
</html>
5. Modify the stream.js file You now need to put your new streams into the stream.js file. You need to be very careful with this – a single misplaced comma could stop the whole thing working! I strongly suggest that you make a backup copy of the working file before you start messing with it.
The first part of this file specifies the URLs of your media streams. In the version that you have there may be some extra lines starting with //. These are ignored by the system and can be deleted (I changed the host that I was using, which is why they are there). It should look like this.
Code:var streamList = [
'http://semellion.awardspace.com/off.html',
'http://semellion.awardspace.com/baroque.html',
'http://semellion.awardspace.com/party.html',
'http://semellion.awardspace.com/sexy.html',
'http://semellion.awardspace.com/iparty.html',
'http://semellion.awardspace.com/wazee.html',
'http://semellion.awardspace.com/jazz.html'
];
Simply change the URLs to point to the URLs you created in step 4 (keeping the first one in the list the “Off” channel). Make sure that the URLs are inside a single inverted comma – as shown above, and make sure that there is a comma at the end of each URL line except for the last one.
Once you have done that, give your new stations titles by modifying the next part of the streams.js file. In my version it looks like this:
Code:var playTitles = [
' ',
'Playlist: Baroque Classics',
'Playlist: Party Music',
'Playlist: Romatic Songs',
'Radio: iPartyRadio',
'Radio: Radio Wazee',
'Radio: Jazz 88.3 FM'
];
Again, make sure that each title is surrounded by single inverted commas, and has a comma at the end of the line. You can put any text in here you like – but since it is displayed in the zaby on the controller I suggest you keep it short. NB the first title in the list is just a single space – this is the “Off” channel, so it has no title!
You can ignore the rest of the streams.js file – I’m not doing much with that information at the moment (leave it there, though, otherwise things will go horribly wrong).
That’s it. You should now be able to change channels to your own streams now.
Customising the buttonsThis section is continued below.