How to add last.fm radio to any site

RSS
Partager

30 jan. 2007, 5h50m

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>

Commentaires

  • bannoy

    That works great, thanks for that tip :D

    4 fév. 2007, 2h23m
  • 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

    14 mars 2007, 4h05m
Voir les 2 commentaires
Ajouter un commentaire. Connectez-vous à Last.fm ou inscrivez-vous (c'est gratuit).