1
0
Fork 0

It fucking works. again.

This commit is contained in:
magnolia-fan 2011-04-15 01:19:58 +04:00
parent 5939bbff2c
commit 82f2624ed5
1 changed files with 4 additions and 4 deletions

View File

@ -14,7 +14,6 @@ $(function(){
}
});
});
audio = document.getElementsByTagName('audio')[0];
$('#player .play').click(function(){
if (! audio.src) return;
audio.play();
@ -66,7 +65,7 @@ $(function(){
function updatePlayer() {
duration = audio.duration;
cur_time = audio.currentTime;
if (cur_time == duration) {
if (cur_time > 0 && cur_time == duration) {
playNext();
}
loaded = 0;
@ -151,11 +150,12 @@ function addToPlaylist(artist, track, length, id) {
}
function addAudio(id) {
if ($('#audio_'+ id).length == 0) {
$('#audiobox').append('<audio id="audio_'+ id +'" src="/listen/'+ id +'.mp3" preload="preload"></audio>');
$('#audiobox').append('<audio id="audio_'+ id +'" src="" preload="preload"></audio>');
$('#audio_'+ id).attr('src', '/listen/'+ id +'.mp3');
}
}
function switchAudio(id) {
if (audio) {
if (typeof(audio) != 'undefined') {
audio.pause();
audio.currentTime = 0;
}