try replacing the code posted in your question with this. Just a warning, it kind of assumes other parts of your code are working.
$(document).on('click', '#Playlist li', function(){
var videoID = $(this).find('img').attr("src").slice(27,38);
player.loadVideoById(videoID);
var nextVideo = $(this).next().find('img');
player.addEventListener('onStateChange', function stopCycle(event) {
if (event.data == YT.PlayerState.ENDED) {
$(nextVideo).click();
}
});
});
basically, you don't even need the each loop. this handles any li living in #PLaylist ever by delegating the event.