myPlayer1

myPlayer2

 

 

	Results will show up here.
  1. <script>
  2.  
  3. function getPlayerPlaylist(theID){
  4. // Get a handle to a player using the "id"
  5. var player = wimpy.getPlayer(theID);
  6. // Retrieve the player's playlist
  7. var playlist = player.getPlaylist();
  8. // Set up a string to return
  9. var out = theID + " playlist:<br>";
  10. // Parse the javascript playlist. For each item
  11. // in the playlist, get the title and file
  12. for(var i=0; i<playlist.length; i++){
  13. // Get the next item
  14. var item = playlist[i];
  15. // Add text to the autput
  16. out += "title: " + item.title + " file : " + item.file + "<br>";
  17. }
  18. // return the text
  19. return out + "";
  20. }
  21. function doit(){
  22.  
  23. var out = document.getElementById("showOuptut");
  24. out.innerHTML = getPlayerPlaylist("myPlayer1") + getPlayerPlaylist("myPlayer2");
  25. }
  26.  
  27. </script>
  28.  
  29.  
  30.  
  31.  
  32. <div id="myPlayer1" data-wimpyplayer data-media="../song1.mp3"></div>
  33. <p>myPlayer1</p>
  34.  
  35.  
  36. <div id="myPlayer2" data-wimpyplayer data-media="../song2.mp3"></div>
  37. <p>myPlayer2</p>
  38.  
  39.  
  40. <!-- A simple button to ping the "doit" function. -->
  41. <p><input type="button" onclick="doit()" value="Get Player Info"></p>
  42.  
  43.  
  44. <pre id="showOuptut"> Results will show up here.
  45. </pre>
giItT1WQy@!-/#