click to load and play playlist
click to load and play playlist
click to load and play playlist
- <script>
-
- // Put variable on the window scope so all function have access to the var.
- var player;
-
- var myPlaylist1 = '[{"title":"json track 1","file":"../song1.mp3"},{"title":"json track 2","file":"../song2.mp3"},{"title":"json track 3","file":"../song3.mp3"}]';
-
- var myPlaylist2 = [
- {
- title : "js track 1",
- file : "../song1.mp3"
- },
- {
- title : "js track 2",
- file : "../song2.mp3"
- },
- {
- title : "js track 2",
- file : "../song2.mp3"
- }
- ];
-
- // The function to edit the "live" playlist
- function loadAndPlayPlaylist(playlist, kind){
-
- if( ! player ){
- player = wimpy.getPlayer("myPlayer");
- }
-
- player.setPlaylist(playlist, true, kind);
-
- }
-
- </script>
-
- <div id="myPlayer" data-wimpyplayer data-media="none"></div>
-
-
- <p onclick="loadAndPlayPlaylist('../song1.mp3|../song2.mp3|../song3.mp3', 'dtxt')">click to load and play playlist</p>
- <p onclick="loadAndPlayPlaylist(myPlaylist1, 'json')">click to load and play playlist</p>
- <p onclick="loadAndPlayPlaylist(myPlaylist2, 'js')">click to load and play playlist</p>