Adds back setting the volume up / down using the keyboard

- Adds a volume field to the player service. It is set directly, no need for get/set...
- Adds a watcher in player-directive to set jPlayer's volume accordingly
- Adds turnVolumeUp and turnVolumeDown methods to the main scope. For the moment they are fine there, we'll maybe move them to the player service if they are called by anything else.
- Adds get/save/delete for the volume in the persistence service.
This commit is contained in:
Hyzual 2015-02-08 22:03:03 +01:00
parent 8529e331a2
commit a85865371c
8 changed files with 196 additions and 57 deletions

View file

@ -348,6 +348,26 @@ angular.module('JamStash')
}
};
$scope.turnVolumeUp = function () {
var volume = player.volume;
if ((volume+0.1) > 1 || volume < 0) {
volume = 0.9;
}
volume += 0.1;
player.volume = volume;
persistence.saveVolume(volume);
};
$scope.turnVolumeDown = function () {
var volume = player.volume;
if (volume > 1 || (volume-0.1) < 0) {
volume = 0.1;
}
volume -= 0.1;
player.volume = volume;
persistence.saveVolume(volume);
};
$rootScope.addToJukebox = function (id) {
if (globals.settings.Debug) { console.log("LOAD JUKEBOX"); }
$.ajax({
@ -416,6 +436,7 @@ angular.module('JamStash')
persistence.loadQueue();
persistence.loadTrackPosition();
}
player.volume = persistence.getVolume();
}
/* End Startup */
}]);