1
0
Fork 0

Fixed autoplay bug #84

This commit is contained in:
magnolia-fan 2011-06-29 03:44:39 +04:00
parent 67888f5fe6
commit 088435452b
2 changed files with 6 additions and 2 deletions

View File

@ -69,6 +69,8 @@ class Player
$('.playlist').html($('.playlist-tracks')).scrollbar
$('.playlist-tracks').sortable axis: 'y', handle: '.dragbox'
console.log _player.hasTrack()
console.log initial_count
if autoplay
_player.setTrack($('.playlist-tracks li').last().attr('id').split('i')[1])
else if initial_count == 0 and not _player.hasTrack()
@ -99,7 +101,7 @@ class Player
hasTrack: ->
if $('#jplayer audio').length > 0
return $('#jplayer audio').attr('src')?
return $('#jplayer audio').attr('src')? and $('#jplayer audio').attr('src') != ''
else if $('#jplayer object').length > 0
$('#jplayer').jPlayer 'play'
true

View File

@ -80,6 +80,8 @@ Player = (function() {
axis: 'y',
handle: '.dragbox'
});
console.log(_player.hasTrack());
console.log(initial_count);
if (autoplay) {
_player.setTrack($('.playlist-tracks li').last().attr('id').split('i')[1]);
} else if (initial_count === 0 && !_player.hasTrack()) {
@ -116,7 +118,7 @@ Player = (function() {
};
Player.prototype.hasTrack = function() {
if ($('#jplayer audio').length > 0) {
return $('#jplayer audio').attr('src') != null;
return ($('#jplayer audio').attr('src') != null) && $('#jplayer audio').attr('src') !== '';
} else if ($('#jplayer object').length > 0) {
$('#jplayer').jPlayer('play');
true;