{"action":"created","issue":{"url":"https://api.github.com/repos/kolber/audiojs/issues/47","labels_url":"https://api.github.com/repos/kolber/audiojs/issues/47/labels{/name}","comments_url":"https://api.github.com/repos/kolber/audiojs/issues/47/comments","events_url":"https://api.github.com/repos/kolber/audiojs/issues/47/events","html_url":"https://github.com/kolber/audiojs/issues/47","id":2207937,"number":47,"title":"multiple playlists","user":{"login":"darije","id":722234,"avatar_url":"https://avatars.githubusercontent.com/u/722234?v=3","gravatar_id":"","url":"https://api.github.com/users/darije","html_url":"https://github.com/darije","followers_url":"https://api.github.com/users/darije/followers","following_url":"https://api.github.com/users/darije/following{/other_user}","gists_url":"https://api.github.com/users/darije/gists{/gist_id}","starred_url":"https://api.github.com/users/darije/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/darije/subscriptions","organizations_url":"https://api.github.com/users/darije/orgs","repos_url":"https://api.github.com/users/darije/repos","events_url":"https://api.github.com/users/darije/events{/privacy}","received_events_url":"https://api.github.com/users/darije/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2011-11-11T10:01:52Z","updated_at":"2015-04-09T11:51:48Z","closed_at":null,"body":"is it possible (and how) to create multiple playlists on one page?\r\ntnx"},"comment":{"url":"https://api.github.com/repos/kolber/audiojs/issues/comments/91207114","html_url":"https://github.com/kolber/audiojs/issues/47#issuecomment-91207114","issue_url":"https://api.github.com/repos/kolber/audiojs/issues/47","id":91207114,"user":{"login":"Izoniz","id":2244040,"avatar_url":"https://avatars.githubusercontent.com/u/2244040?v=3","gravatar_id":"","url":"https://api.github.com/users/Izoniz","html_url":"https://github.com/Izoniz","followers_url":"https://api.github.com/users/Izoniz/followers","following_url":"https://api.github.com/users/Izoniz/following{/other_user}","gists_url":"https://api.github.com/users/Izoniz/gists{/gist_id}","starred_url":"https://api.github.com/users/Izoniz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Izoniz/subscriptions","organizations_url":"https://api.github.com/users/Izoniz/orgs","repos_url":"https://api.github.com/users/Izoniz/repos","events_url":"https://api.github.com/users/Izoniz/events{/privacy}","received_events_url":"https://api.github.com/users/Izoniz/received_events","type":"User","site_admin":false},"created_at":"2015-04-09T11:51:48Z","updated_at":"2015-04-09T11:51:48Z","body":"Hello! If you need it in separate ol you should find next ol everytime. \r\nIf you have 2 albums you can add class=\"album\" in ol and comment this line: \r\n```javascript\r\nif (!next.length) next = $('ol.album li').first();\r\n```\r\nAnd add this code on it's place.\r\n```javascript\r\n            if (!next.length) {   \r\n\t\t\t\t$('ol li.playing').parent().removeClass('album');\r\n\t\t\t\tnext = $('ol.album li').first();\r\n\t\t\t\t$('ol li.playing').parent().addClass('album');\r\n\t\t\t}\r\n```\r\nYou also need to comment 2 lines in this code:\r\n```javascript\r\n        // Load in a track on click\r\n        $('ol li').click(function(e) {\r\n          e.preventDefault();\r\n          //$('ol').removeClass('album');\r\n          //$(this).parent().addClass('album');\r\n          $('ol li').removeClass('playing');\r\n          $(this).addClass('playing');//.siblings().removeClass('playing');\r\n          audio.load($('a', this).attr('data-src'));\r\n          audio.play();\r\n        });\r\n```\r\nAnd you need to change code in // Keyboard shortcuts section.\r\nThis is the full code:\r\n```javascript\r\n$(function() { \r\n        // Setup the player to autoplay the next track\r\n        var a = audiojs.createAll({\r\n          trackEnded: function() {\r\n            var next = $('ol li.playing').next();\r\n            if (!next.length) {   \r\n\t\t\t\t$('ol li.playing').parent().removeClass('album');\r\n\t\t\t\tnext = $('ol.album li').first();\r\n\t\t\t\t$('ol li.playing').parent().addClass('album');\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t//if (!next.length) next = $('ol.next li').first();\r\n            $('ol li').removeClass('playing');\r\n            next.addClass('playing');//.siblings().removeClass('playing');\r\n            audio.load($('a', next).attr('data-src'));\r\n            audio.play();\r\n          }\r\n        });\r\n\r\n     // Load in the first track\r\n        var audio = a[0];\r\n            first = $('ol a').attr('data-src');\r\n        $('ol').first().addClass('album');\r\n        $('ol li').first().addClass('playing');\r\n        audio.load(first);\r\n\r\n        // Load in a track on click\r\n        $('ol li').click(function(e) {\r\n          e.preventDefault();\r\n          //$('ol').removeClass('album');\r\n          //$(this).parent().addClass('album');\r\n          $('ol li').removeClass('playing');\r\n          $(this).addClass('playing');//.siblings().removeClass('playing');\r\n          audio.load($('a', this).attr('data-src'));\r\n          audio.play();\r\n        });\r\n\r\n        // Keyboard shortcuts\r\n        $(document).keydown(function(e) {\r\n          var unicode = e.charCode ? e.charCode : e.keyCode;\r\n             // right arrow\r\n          if (unicode == 39) {\r\n            var next = $('li.playing').next();\r\n            if (!next.length) {   \r\n\t\t\t\t$('ol li.playing').parent().removeClass('album');\r\n\t\t\t\tnext = $('ol.album li').first();\r\n\t\t\t\t$('ol li.playing').parent().addClass('album');\r\n\t\t\t}\r\n            next.click();\r\n            // back arrow\r\n          } else if (unicode == 37) {\r\n            var prev = $('li.playing').prev();\r\n            if (!prev.length) {   \r\n\t\t\t\t$('ol li.playing').parent().removeClass('album');\r\n\t\t\t\tprev = $('ol.album li').last();\r\n\t\t\t\t$('ol li.playing').parent().addClass('album');\r\n\t\t\t}\r\n            prev.click();\r\n            // spacebar\r\n          } else if (unicode == 32) {\r\n            audio.playPause();\r\n          }\r\n        })\r\n      });\r\n```\r\n\r\nBut it's not working in 3 or more albums on the page. I just stuck with how to get next ol. If you find the solution it can be much easy to modify this code for playing unlimited albums."}}