angular-soundmanager2
angular-soundmanager2 copied to clipboard
On KeyUp Control Volume & Progress
I want to volume down and up via keyboard control. And made this.
PS: Don't forget to inject "angularPlayer" to your controller.
Demo: http://play.mixboxx.com/
` $scope.setProgress = function (progress) { var playing = soundManager.getSoundById(angularPlayer.getCurrentTrack()); if (progress == "increase") { playing.setPosition(playing.position + 5000); } else { playing.setPosition(playing.position - 5000); } };
$document.bind('keyup', function (e) {
if (e.keyCode == 40) {
angularPlayer.adjustVolume(false);
} else if (e.keyCode == 38) {
angularPlayer.adjustVolume(true);
} else if (e.keyCode == 37) {
$scope.setProgress("decrease");
} else if (e.keyCode == 39) {
$scope.setProgress("increase");
}
});`