Playing *.mp3 file. How to add a mp3 player within a site
Running ...


Without a reader


  • The *.mp3 file must be completely loaded into the local computer. The sound is then played with the local reader associated with *.mp3 files



With a reader


  • This allow to read the *.mp3 file like a stream. The sound is played as soon (few seconds) after reading.
    • The user don't wait
    • Listen O Fortuna, Carl Orff, Carmina Burana




Insert the Reader with a Google Gadget


  • More informations here : 



Using a Playlist with XSPF Web Music Player


  • XSPF Web Music Player is a flash-based web application that uses xspf playlist format to play mp3 songs. XSPF is the XML Shareable Playlist Format
  • I use the Extended version
  • Upload into your site the xspf_player.swf
  • The Playlist and the Player must be hosted in the same Domain



Creating a Playlist


  • Technical specification can be found in XSPF (spiff) site
  • The basic structure of the .xspf file is as follows :


<?xml version="1.0" encoding="UTF-8"?>
<playlist version="0" xmlns = "http://xspf.org/ns/0/">

<title>My Playlist</title>

<trackList>

<track>
<location>URL/name1.mp3</location>
<image>URL/name1_pic.jpg</image>
<annotation>info text for name1</annotation>
<info>URL for more info about name1</info>
</track>

<track>
...
</track>
</trackList>
</playlist>
  • Save the file with the extension .xspf and upload it into your site


Using <object> to embed XSPF player


  • Type this code, data and value must be typed within one line, with same content :

<object type="application/x-shockwave-flash"
data="http://YOURSITE/xspf_player.swf?
autoload=true
&playlist_url=http://YOURSITE/tracklist.xspf"
width="400" height="170">

<param name="movie"
value="http://YOURSITE/xspf_player.swf?
autoload=true
&playlist_url=http://YOURSITE/tracklist.xspf">
<param name="allowScriptAccess" value="always'>
<param name="quality" value="high">
<param name="bgcolor" value="#c3d9ff">

</object>

  • To configure the player, use these parameters :


&playlist_url : the url of the xspf file to load

&autoplay : true/false, to start playing without click

&autoload : true/false to load the playlist without click


  • Listen my Playlist :




Removing the <object> tag



  • We can call the player with a javascript :


<script type="text/javascript">

AC_FL_RunContent('width','440'
,'height','180'
,'type','application/x-shockwave-flash'
,'src','http://YOURSITE/xspf_player?
playlist_url=http://YOURSITE/tracklist.xspf'
,'allowScriptAccess','always'
,'quality','high'
,'bgcolor','#c3d9ff');

</script>
  • The javascript use this script : AC_FL_RunContent. We call the script with this : 

<script src="http://YOURSITE/AC_RunActiveContent.js" type="text/javascript"></script>

  • Listen my Playlist, calling the player without <object> tag :




A Google Gadget with a Flash Reader



flash_playlist.xml
 
  



More Informations








One Day - One Label - One Wine