Print

Connect to your website

Written by Saii Hallard. Posted in Streaming

Important note: This article is informational only. To make this work it requires you have at least basic knowledge of html, php and possibly network administration permissions. We will NOT give support for this in particular.

 

How to get a play button on your website

The MCD of your SHX receiver has an option to post the current stream URL to a php page on your web domain.
This make it possible to let people that browse on your website to listen in on the stream directly.

However to make this possible you need the following:

  • Knowledge of PHP and making websites.
  • A streamplayer
  • A website that supports PHP and has enough bandwidth, since the stream will "go through" your website.
  • Knowledge of the complications of streaming commercial music, be wary!

What???!

If you ask yourself the above question, then please stop here. I will not go into every little detail, because I can not teach you the basic knowledge you need to have to facilitate this, nor do I want to.

 

Embed Mediaplayer

An easy option is to use Microsoft Mediaplayer as an embedded activex control.
Disadvantage however is that this is not available for non-windows users.

To make this work I have made an example in php, which you can download here: shx-embed-php.zip.

I emphasize again that this is an unsupported example to get you started, you may encounter problems with php safe mode, permissions to write files and more of that. Do not try to make this work if you have no experience with it, as we will not give support for this.

It is a simple example where the index-rewrite.php reads a source html page, replaces all placeholder variables with the streamurl that is supplied by the MCD in Second Life, then writes it into the index.html that is shown on your website. The final index.html has got an mediaplayer with the stream url that you are streaming to in Second Life.

All you have to do in Second Life, is add the url to the php, for example like this:

http://www.shxmeta.com/src/index-rewrite.php?streamurl=

So, to summarize:
The MCD posts the current stream url to the php
The php reads your index-source.html, replaces the placeholders
And the php writes the modified index-source.html to index.html

A working example can be seen on the website from Club Buddha's owner:
Dyna-Mics

 

Streamplayer

A good streamplayer to make it work for everyone (not only windows users) is Wimpybutton. It's well documented, easy to use and can stream SHOUTcast and ICEcast. It is (as most good software) however not free.

An example of the playbutton I have placed here:

The Wimpybutton is the thing you need to buy and register to your web domain.
When you have installed it and know how it works, then get the Wimpycast addon, which is free.

 

Connecting PHP with the SHX MCD

If you are using the wimpycast, then just edit the wimpycast.php and add a parameter.

For example:

$streamurl = $_REQUEST['streamurl'];

Of course you have to add some more code to split the port and address from the full url that is posted.
Also, you have to put the address to an internal file, so any web user can press the play button and the play button knows what stream is current.

In example:
http://www.shxmeta.com/wimpycast.php?streamurl=http://192.168.0.1:8000/

If the above works in your browser (it succesfully post any streamurl to the php, splits the address and port and plays it back, stores the address in an internal file), then you are set to use it together with the SHX mcd in SL.

Now, when you made the php page and verified it's working, add the php address to the MCD, but of course leave out the address you used for testing. So, in the above example, add the following address to the MCD:

http://www.shxmeta.com/wimpycast.php?streamurl=

This ensures that the MCD will add the streamadress at the end of the php.