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