Using the new HTML5 <video> tag and the Video For Everybody no Javascript embed method.
See also: the video chapter of Mark Pilgrim'sDive Into HTML5 book for info regarding video encoding methods and more advanced embed options for browsers not yet supporting the <video> tag.
If $loop is set to true, the format returns as: 3 hours 24 minutes 15 seconds.
If $loop is set to false (or left as the default), it returns as: 3 hours.
Here is a simple little PHP snippet I use to display the most recent tracks from my Last FM profile. The example below prints in a similar format to the list I have started including on the homepage.
This uses the curlContents function that you can grab from here.
This also uses the PHP5 json_decode function. Peeps with older versions of PHP will need to either hunt down an alternative or UPGRADE!
You will need to replace the YOUR_USER_NAME and YOUR_API_KEY values (obvs)
$cache_file is the absolute path to a cache version of the html that is created. The file will need to have the usual read/write permissions.
In this example I check to see if the cache file has been updated in the past 10 minutes (ie. 600 seconds) and if not - I update it. There is also a built-in $force_update to assist with testing.