diff options
author | Nicolas Bornand <nicolas74@gmail.com> | 2014-05-11 23:09:35 +0200 |
---|---|---|
committer | Nicolas Bornand <nicolas74@gmail.com> | 2014-05-11 23:09:35 +0200 |
commit | 3efc7a211a76fa2fbd092b281951b5f9a0438bee (patch) | |
tree | 811245d2d29073e12ca9295b0fd8c8a74a93d57f /app/js/services.js | |
parent | b3e138c07099fadd990b156d5d7ea9b957028ce0 (diff) | |
download | playGraph-3efc7a211a76fa2fbd092b281951b5f9a0438bee.tar.gz playGraph-3efc7a211a76fa2fbd092b281951b5f9a0438bee.tar.bz2 playGraph-3efc7a211a76fa2fbd092b281951b5f9a0438bee.zip |
add songs
Diffstat (limited to 'app/js/services.js')
-rw-r--r-- | app/js/services.js | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/app/js/services.js b/app/js/services.js index 9913856..d18e923 100644 --- a/app/js/services.js +++ b/app/js/services.js @@ -11,18 +11,18 @@ app.service('pathService', function() { }, computePlaylist: function(songList, line, duration) { //compute distances from the constrain path - console.log('length',line.length); - + console.log('length', line.length); + var threshold = 60; - angular.forEach(songList, function(song){ + angular.forEach(songList, function(song) { song.selected = false; }); - + var selection = []; - angular.forEach(line, function(point){ - angular.forEach(songList, function(song){ + angular.forEach(line, function(point) { + angular.forEach(songList, function(song) { var d = self.dist(song, point); - if(d < threshold && song.selected !== true){ + if (d < threshold && song.selected !== true) { selection.push(song); song.selected = true; } @@ -33,3 +33,18 @@ app.service('pathService', function() { }; return self; }); +app.service('musicPlayer', function() { + var self = { + musicTimer: null, + startSongWithDuration: function(id, duration) + { + $('#ytplayer').attr('src', 'https://www.youtube.com/embed/' + id + '?autoplay=1&modestbranding=1'); + self.musicTimer = setInterval(changeSong, duration * 1000); + }, + changeSong: function() + { + clearInterval(self.musicTimer); + } + }; + return self; +}); |