Fixed album changing process
This commit is contained in:
parent
78eb16d137
commit
11e0377b36
@ -75,7 +75,7 @@ function getAlbumSongs(albumElem) {
|
||||
playlist.append(songElem);
|
||||
}
|
||||
|
||||
changeSelectedTrack(playlist.find('.selected'));
|
||||
changeAudioSources(playlist.find('.selected'), false);
|
||||
});
|
||||
}
|
||||
|
||||
@ -89,14 +89,18 @@ function changeSelectedTrack(trackElem) {
|
||||
newSelected.addClass('selected');
|
||||
|
||||
// now change the audio sources
|
||||
changeAudioSources(trackElem);
|
||||
changeAudioSources(trackElem, true);
|
||||
}
|
||||
}
|
||||
|
||||
function changeAudioSources(trackElem) {
|
||||
function changeAudioSources(trackElem, autoplay) {
|
||||
trackElem = $(trackElem);
|
||||
var playerSources = $('#music-player source');
|
||||
|
||||
if (autoplay === null) {
|
||||
autoplay = false;
|
||||
}
|
||||
|
||||
// retrieve audio file path from selected element
|
||||
var audioFilePath = trackElem.data('path');
|
||||
|
||||
@ -116,6 +120,9 @@ function changeAudioSources(trackElem) {
|
||||
|
||||
// reload music player
|
||||
player.load();
|
||||
|
||||
if (autoplay) {
|
||||
// start playing new song
|
||||
player.play();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user