Adds more methods to control the queue in the player service.

- Adds : empty queue, shuffle queue, add one song to queue, remove one song from queue, restart the current song
- Removes the "playEnded" method : we now use correctly scope.$apply() in the directive after calling nextTrack(). The next song is correctly called after the end of the current one.
- Starts replacing the old rootScope functions with calls to the player service.
This commit is contained in:
Hyzual 2014-12-21 10:26:29 +01:00
parent f4afa67598
commit 7074e9abc8
8 changed files with 145 additions and 66 deletions

View file

@ -5,16 +5,26 @@ angular.module('jamstash.queue.controller', ['jamstash.player.service'])
'use strict';
$scope.settings = globals.settings;
$scope.player = player;
//$scope.song = player.queue;
//angular.copy($rootScope.queue, $scope.song);
$scope.itemType = 'pl';
$scope.itemType = 'pl'; // TODO: Hyz: What is this ?
$scope.playSong = function (song) {
console.log('Queue Controller - playSong()', song);
player.play(song);
};
$scope.queueEmpty = function () {
player.queue = [];
$scope.queueEmpty = function() {
player.emptyQueue();
};
$scope.queueShuffle = function() {
player.shuffleQueue();
};
$scope.addSongToQueue = function(song) {
player.addSong(song);
};
$scope.removeSongFromQueue = function(song) {
player.removeSong(song);
};
}]);