Check to see if the player is playing or not.

  1. <!-- Create a player -->
  2. <div id="player1" data-wimpyplayer data-media="../song1.mp3|../song2.mp3"></div>
  3.  
  4.  
  5. <!-- A simple button to ping the "doit" function. -->
  6. <button onclick="checkPlaying()">Check Playing</button>
  7.  
  8. <script>
  9.  
  10. // Put variable on the window scope so all function have access to the var.
  11. var player;
  12.  
  13. // The function to edit the "live" playlist
  14. function checkPlaying(){
  15.  
  16. if( ! player ){
  17. player = wimpy.getPlayer("player1");
  18. }
  19. // The alert should show a 1 or a 0, where 1=playing and 0 = paused/stopped/not playing
  20. alert ( player.getPlaying() );
  21.  
  22. }
  23.  
  24. </script>
giItT1WQy@!-/#