Fixed autoplay bug #84
This commit is contained in:
parent
67888f5fe6
commit
088435452b
|
@ -69,6 +69,8 @@ class Player
|
||||||
$('.playlist').html($('.playlist-tracks')).scrollbar
|
$('.playlist').html($('.playlist-tracks')).scrollbar
|
||||||
$('.playlist-tracks').sortable axis: 'y', handle: '.dragbox'
|
$('.playlist-tracks').sortable axis: 'y', handle: '.dragbox'
|
||||||
|
|
||||||
|
console.log _player.hasTrack()
|
||||||
|
console.log initial_count
|
||||||
if autoplay
|
if autoplay
|
||||||
_player.setTrack($('.playlist-tracks li').last().attr('id').split('i')[1])
|
_player.setTrack($('.playlist-tracks li').last().attr('id').split('i')[1])
|
||||||
else if initial_count == 0 and not _player.hasTrack()
|
else if initial_count == 0 and not _player.hasTrack()
|
||||||
|
@ -99,7 +101,7 @@ class Player
|
||||||
|
|
||||||
hasTrack: ->
|
hasTrack: ->
|
||||||
if $('#jplayer audio').length > 0
|
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
|
else if $('#jplayer object').length > 0
|
||||||
$('#jplayer').jPlayer 'play'
|
$('#jplayer').jPlayer 'play'
|
||||||
true
|
true
|
||||||
|
|
|
@ -80,6 +80,8 @@ Player = (function() {
|
||||||
axis: 'y',
|
axis: 'y',
|
||||||
handle: '.dragbox'
|
handle: '.dragbox'
|
||||||
});
|
});
|
||||||
|
console.log(_player.hasTrack());
|
||||||
|
console.log(initial_count);
|
||||||
if (autoplay) {
|
if (autoplay) {
|
||||||
_player.setTrack($('.playlist-tracks li').last().attr('id').split('i')[1]);
|
_player.setTrack($('.playlist-tracks li').last().attr('id').split('i')[1]);
|
||||||
} else if (initial_count === 0 && !_player.hasTrack()) {
|
} else if (initial_count === 0 && !_player.hasTrack()) {
|
||||||
|
@ -116,7 +118,7 @@ Player = (function() {
|
||||||
};
|
};
|
||||||
Player.prototype.hasTrack = function() {
|
Player.prototype.hasTrack = function() {
|
||||||
if ($('#jplayer audio').length > 0) {
|
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) {
|
} else if ($('#jplayer object').length > 0) {
|
||||||
$('#jplayer').jPlayer('play');
|
$('#jplayer').jPlayer('play');
|
||||||
true;
|
true;
|
||||||
|
|
Loading…
Reference in New Issue