This Player Instance has the ID set to "myPlayer"

 

 

	Results will show up here.
  1. <script>
  2.  
  3.  
  4. function doit(){
  5.  
  6. // Get a handle to a player using the "myPlayer" ID we
  7. // defined when establishing the Player Instance DIV.
  8. var player = wimpy.getPlayer("myPlayer");
  9. // Retrieve the player's playlist
  10. var playlist = player.getPlaylist();
  11. // Set up a string to use to put the data into.
  12. var output = "";
  13. // Parse the javascript playlist. The returned playlist is
  14. // an array of Track Datasets. Track Datasets are simple
  15. // Javascript Objects. For each item in the playlist,
  16. // get the title and file
  17. for(var i=0; i<playlist.length; i++){
  18. // Get the next Track Dataset item.
  19. var item = playlist[i];
  20. // Parse the Track Dataset to the output string.
  21. for(var prop in item){
  22. // Add a line of text for each property in the Track Dataset.
  23. output += prop + " : " + item[prop] + "<br>";
  24. }
  25. }
  26. // Get the HTML element on this page with the "id" of
  27. // "showOuptut" (which is the <pre> tag on this page).
  28. var outputElem = document.getElementById("showOuptut");
  29. // Set the HTML in the <pre> to the results returned from wimpy.
  30. outputElem.innerHTML = output;
  31. }
  32.  
  33. </script>
  34.  
  35.  
  36.  
  37.  
  38. <div id="myPlayer" data-wimpyplayer data-media="../song1.mp3"></div>
  39. <p>This Player Instance has the ID set to "myPlayer"</p>
  40.  
  41.  
  42.  
  43. <!-- A simple button to ping the "doit" function. -->
  44. <p><input type="button" onclick="doit()" value="Get Playlist"></p>
  45.  
  46.  
  47. <pre id="showOuptut"> Results will show up here.
  48. </pre>
giItT1WQy@!-/#