Listener return info will appear here.
  1. <!-- Set up a player instance DIV, defining the ID so we can target it. -->
  2. <div id="MyTarget"></div>
  3.  
  4. <script>
  5.  
  6.  
  7.  
  8. // Set up a function to handle the listener dispatch:
  9. function launchCallback(trackData, customArgument){
  10. // This will render the returned data to the DIV below that has the ID of "output".
  11. showObject(trackData, "output", true, "Lauch");
  12. showObject(customArgument, "output", true, "Launch custom argument");
  13. }
  14. function playCallback(trackData, customArgument){
  15. showObject(trackData, "output", true, "Play");
  16. showObject(customArgument, "output", true, "Play custom argument");
  17. }
  18. function pauseCallback(trackData, customArgument){
  19. showObject(trackData, "output", true, "Pause");
  20. showObject(customArgument, "output", true, "Pause custom argument");
  21. }
  22. function doneCallback(trackData, customArgument){
  23. showObject(trackData, "output", true, "Done");
  24. showObject(customArgument, "output", true, "Done custom argument");
  25. }
  26.  
  27. function playlistReadyCallback(trackData, customArgument){
  28. showObject(trackData, "output", true, "Playlist Ready");
  29. showObject(customArgument, "output", true, "Playlist Ready custom argument");
  30. }
  31. function playlistCompleteCallback(trackData, customArgument){
  32. showObject(trackData, "output", true, "Playlist Complete");
  33. showObject(customArgument, "output", true, "Playlist Complete custom argument");
  34. }
  35. function linkCallback(trackData, customArgument){
  36. showObject(trackData, "output", true, "Link");
  37. showObject(customArgument, "output", true, "Link custom argument");
  38. }
  39. function downloadCallback(trackData, customArgument){
  40. showObject(trackData, "output", true, "Download");
  41. showObject(customArgument, "output", true, "Download custom argument");
  42. }
  43.  
  44. // No data is returned for these listeners.
  45. function readyCallback(customArgument){
  46. showObject("No data is returned with this listener", "output", true, "Player Ready");
  47. showObject(customArgument, "output", true, "Player Ready custom argument");
  48. }
  49. function skinReadyCallback(customArgument){
  50. showObject("No data is returned with this listener", "output", true, "Skin Ready");
  51. showObject(customArgument, "output", true, "Skin Ready custom argument");
  52. }
  53. function enabledCallback(customArgument){
  54. showObject("No data is returned with this listener", "output", true, "Enabled");
  55. showObject(customArgument, "output", true, "Enabled custom argument");
  56. }
  57. function disabledCallback(customArgument){
  58. showObject("No data is returned with this listener", "output", true, "Disabled");
  59. showObject(customArgument, "output", true, "Disabled custom argument");
  60. }
  61. function resizeCallback(customArgument){
  62. showObject("No data is returned with this listener", "output", true, "Resize");
  63. showObject(customArgument, "output", true, "Resize custom argument");
  64. }
  65.  
  66.  
  67. var myPlayer = new wimpyPlayer({
  68. target: "MyTarget",
  69. media : "../song1.mp3|../song2.mp3|../song3.mp3"
  70. });
  71.  
  72. // Add the "play" listener.
  73. myPlayer.addListener("ready", readyCallback, this, "my arg");
  74. myPlayer.addListener("launch", launchCallback, this, "my arg");
  75. myPlayer.addListener("play", playCallback, this, "my arg");
  76. myPlayer.addListener("pause", pauseCallback, this, "my arg");
  77. myPlayer.addListener("done", doneCallback, this, "my arg");
  78. myPlayer.addListener("skinReady", skinReadyCallback, this, "my arg");
  79. myPlayer.addListener("enabled", enabledCallback, this, "my arg");
  80. myPlayer.addListener("disabled", disabledCallback, this, "my arg");
  81. myPlayer.addListener("playlistReady", playlistReadyCallback, this, "my arg");
  82. myPlayer.addListener("playlistComplete", playlistCompleteCallback, this, "my arg");
  83. myPlayer.addListener("link", linkCallback, this, "my arg");
  84. myPlayer.addListener("download", downloadCallback, this, "my arg");
  85. myPlayer.addListener("resize", resizeCallback, this, "my arg");
  86.  
  87. </script>
  88.  
  89. <!-- This is used to print the output to the page -->
  90. <pre id="output">Listener return info will appear here.</pre>
giItT1WQy@!-/#