You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
72 lines
2.1 KiB
HTML
72 lines
2.1 KiB
HTML
6 years ago
|
<style type="text/css">
|
||
|
#playlist,audio{background:#666;width:400px;padding:20px;}
|
||
|
.active a{color:#5DB0E6;text-decoration:none;}
|
||
|
li a{color:#eeeedd;background:#333;padding:5px;display:block;}
|
||
|
li a:hover{text-decoration:none;}
|
||
|
</style>
|
||
|
|
||
|
<audio id="audio" preload="auto" tabindex="0" controls="" >
|
||
|
<source src="podcasts/podcast.20190422-2209.mp3">
|
||
|
Your Fallback goes here
|
||
|
</audio>
|
||
|
|
||
|
<ul id="playlist">
|
||
|
<li class="active">
|
||
|
<a href="podcasts/podcast.20190422-2209.mp3">
|
||
|
Ravel Bolero
|
||
|
</a>
|
||
|
</li>
|
||
|
<li>
|
||
|
<a href="podcasts/3_podcast.mp3">
|
||
|
Moonlight Sonata - Beethoven
|
||
|
</a>
|
||
|
</li>
|
||
|
<li>
|
||
|
<a href="http://www.archive.org/download/CanonInD_261/CanoninD.mp3">
|
||
|
Canon in D Pachabel
|
||
|
</a>
|
||
|
</li>
|
||
|
<li>
|
||
|
<a href="http://www.archive.org/download/PatrikbkarlChamberSymph/PatrikbkarlChamberSymph_vbr_mp3.zip">
|
||
|
patrikbkarl chamber symph
|
||
|
</a>
|
||
|
</li>
|
||
|
</ul>
|
||
|
|
||
|
<script type="text/javascript">
|
||
|
$(document).ready(function () {
|
||
|
init();
|
||
|
function init(){
|
||
|
var current = 0;
|
||
|
var audio = $('#audio');
|
||
|
var playlist = $('#playlist');
|
||
|
var tracks = playlist.find('li a');
|
||
|
var len = tracks.length - 1;
|
||
|
audio[0].volume = .10;
|
||
|
audio[0].play();
|
||
|
playlist.on('click','a', function(e){
|
||
|
e.preventDefault();
|
||
|
link = $(this);
|
||
|
current = link.parent().index();
|
||
|
run(link, audio[0]);
|
||
|
});
|
||
|
audio[0].addEventListener('ended',function(e){
|
||
|
current++;
|
||
|
if(current == len){
|
||
|
current = 0;
|
||
|
link = playlist.find('a')[0];
|
||
|
}else{
|
||
|
link = playlist.find('a')[current];
|
||
|
}
|
||
|
run($(link),audio[0]);
|
||
|
});
|
||
|
}
|
||
|
function run(link, player){
|
||
|
player.src = link.attr('href');
|
||
|
par = link.parent();
|
||
|
par.addClass('active').siblings().removeClass('active');
|
||
|
player.load();
|
||
|
player.play();
|
||
|
}
|
||
|
});
|
||
|
</script>
|