How to add last.fm radio to any site

RSS
Condividi

Gen 30 2007, 5:50

Hey, so here's some HTML you can add to a site to get the last.fm radio on it.

Note: you'll need to specify the last.fm station you want the radio to play. There are two places this information goes in the HTML, both are marked below as "[STATION_GOES_HERE]". Replace that with the appropriate information.

Here are some examples of appropriate information:
group/[groupname]
user/[username]/personal
user/[username]/loved
user/[username]/neighbours
globaltags/[taggoeshere]


<script type="text/javascript" src="http://static2.last.fm/jsr/11/prototype.js"></script>;
<script type="text/javascript" src="http://static2.last.fm/jsr/11/main.js"></script>;
<script type="text/javascript">
function notifyOpener()
{
if(self.opener && !self.opener.radioPopup) self.opener.radioPopup = self;
}
function tune(radioURL)
{
var radio = getPlayerEl('lfmPlayer');
radio.SetVariable("radioURL",radioURL);
radio.TCallLabel("/", "HandleJSTuning");
}

function setPopupTitle(title)
{
$("radioTitle").innerHTML = 'Listening to ' + unescape(title);
}
function handleError() { return true; }
window.onerror = handleError;
setInterval(notifyOpener,2000);
</script>
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0"; width="340" height="120" id="lfmPlayer" align="middle"><param name="allowScriptAccess" value="always" />
<param name="movie" value="http://static.last.fm/webclient/30/defaultEmbedPlayer.swf"; />
<param name="FlashVars" value="lang=en&popup=true&lfmMode=radio&radioURL=lastfm://[STATION_GOES_HERE]" />
<param name="quality" value="high" />
<param name="bgcolor" value="#FFFFFF" />
<param name="wmode" value="transparent" />
<param name="swLiveConnect" value="true" />
<embed src="http://static.last.fm/webclient/30/defaultEmbedPlayer.swf"; quality="high" bgcolor="#FFFFFF" width="340" FlashVars="lang=en&popup=true&lfmMode=radio&radioURL=lastfm://[STATION_GOES_HERE]" height="120" wmode="transparent" name="lfmPlayer" swLiveConnect="true" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"; /></object>

Commenti

  • bannoy

    That works great, thanks for that tip :D

    Feb 4 2007, 2:23
  • pjbond

    misleading title. I wanted to add my loved tracks radio to whitehouse.gov and they wouldn't let me. they said they would send someone to see me. I've been hiding behind the sofa all day. thanks for the tip :D

    Mar 14 2007, 4:05
Visualizza tutti (2 commenti)
Aggiungi un commento. Accedi a Last.fm o registrati (è gratuito).