Append playlist with simple urls from an array.

  1. <script>
  2.  
  3. // A simple array containing URLs to mp3 files.
  4. var list = [
  5. "../song1.mp3",
  6. "../song2.mp3",
  7. "../song3.mp3"
  8. ];
  9.  
  10.  
  11. var current = 0;
  12. function doit2(){
  13. // Get a handle to player 2
  14. var player = wimpy.getPlayer("myPlayerID");
  15. // Append the list to the player.
  16. player.appendPlaylist(list);
  17. // FYI: We could also do all the above in one line as:
  18. // wimpy.getPlayer("myPlayerID").appendPlaylist(list);
  19. }
  20.  
  21. </script>
  22.  
  23. <!-- Player 2 instance -->
  24. <div id="myPlayerID" data-wimpyplayer data-sort="none" data-media="../song1.mp3|../song2.mp3" data-skin="../wimpy.skins/003.tsv"></div>
  25.  
  26. <!-- A simple button to ping the "doit" function. -->
  27. <p></p><p><input type="button" onclick="doit2()" value="Add 2 other songs"></p><p>
giItT1WQy@!-/#