finish #386 and implement nextTrack action

This commit is contained in:
Luis Miguel Almánzar 2013-07-18 23:12:52 -04:00
parent 673548b630
commit 47a6b2c0ae
2 changed files with 19 additions and 3 deletions

View File

@ -94,7 +94,7 @@
$(this).off('ended.playnext');
self.queuePlayNext();
self.nextTrack();
}
function startProgressInterval(itemId) {
@ -991,7 +991,7 @@
});
};
self.queuePlayNext = function () {
self.nextTrack = function () {
var newIndex = currentPlaylistIndex + 1;
var newItem = self.playlist[newIndex];
@ -1004,6 +1004,21 @@
});
}
};
self.previousTrack = function () {
var newIndex = currentPlaylistIndex - 1;
if (newIndex >= 0) {
var newItem = self.playlist[newIndex];
if (newItem) {
Dashboard.getCurrentUser().done(function (user) {
self.playInternal(newItem, 0, user);
currentPlaylistIndex = newIndex;
});
}
}
};
self.queueItem = function (item) {

View File

@ -804,9 +804,10 @@ var Dashboard = {
MediaPlayer.seek(msg.Data.SeekPosition);
}
else if (msg.Data.Command === 'NextTrack') {
MediaPlayer.queuePlayNext();
MediaPlayer.nextTrack();
}
else if (msg.Data.Command === 'PreviousTrack') {
MediaPlayer.previousTrack();
}
}
},