aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Odersky <jodersky@gmail.com>2014-05-11 13:57:37 +0200
committerJakob Odersky <jodersky@gmail.com>2014-05-11 13:57:37 +0200
commit370244a1003e3c16f024116d14401e7959325ede (patch)
tree0a00b60688f6ecab51cf13913e161e31058e5866
parent89639a36f7412e1855d539dcca26f86e8daa4a0e (diff)
parent68579f3a451b910ffa47ed9cc7414a5e0338105f (diff)
downloadplayGraph-370244a1003e3c16f024116d14401e7959325ede.tar.gz
playGraph-370244a1003e3c16f024116d14401e7959325ede.tar.bz2
playGraph-370244a1003e3c16f024116d14401e7959325ede.zip
Merge branch 'master' of github.com:jodersky/playGraph
Conflicts: app/js/directives.js
-rw-r--r--app/css/lbarman.css7
-rw-r--r--app/index.html6
-rw-r--r--app/js/app.js18
-rw-r--r--app/js/directives.js10
-rw-r--r--app/js/yt_musicsearch.js18
-rw-r--r--videosearch_n_play.html13
6 files changed, 59 insertions, 13 deletions
diff --git a/app/css/lbarman.css b/app/css/lbarman.css
index a688146..2a2a171 100644
--- a/app/css/lbarman.css
+++ b/app/css/lbarman.css
@@ -51,7 +51,8 @@ body
.selected > .circle {
- background-color: red;
+ background-color: rgba(7,140,255,.6);
+ border-color: black;
}
.point > .songLabel p{
position: relative;
@@ -61,6 +62,10 @@ body
display: none;
font-size: 22px;
}
+.selected > .songLabel p{
+ color:rgb(7,140,255);
+}
+
.point:hover > .songLabel p{
display: block;
}
diff --git a/app/index.html b/app/index.html
index 3b7e019..1b15a7e 100644
--- a/app/index.html
+++ b/app/index.html
@@ -45,6 +45,12 @@
<li data-ng-repeat="song in playseq">{{song.label}}</li>
</ul>
</fieldset>
+
+ <iframe id="ytplayer" type="text/html" width="640" height="360"
+src="https://www.youtube.com/embed/M7lc1UVf-VE?autoplay=1&modestbranding=1"
+frameborder="0" allowfullscreen></iframe>
+
+
</div>
<div id="column-middle">
<div class="world">
diff --git a/app/js/app.js b/app/js/app.js
index c59b849..514f187 100644
--- a/app/js/app.js
+++ b/app/js/app.js
@@ -135,10 +135,24 @@ var dummyPoints= [
},
{
x: 800,
- y: 750,
+ y: 200,
label:"piste f"
},
-
+ {
+ x: 950,
+ y: 300,
+ label:"piste f"
+ },
+ {
+ x: 740,
+ y: 120,
+ label:"piste f"
+ },
+ {
+ x: 900,
+ y: 320,
+ label:"piste f"
+ }
]
var Song = function(point){
diff --git a/app/js/directives.js b/app/js/directives.js
index add724b..428fad1 100644
--- a/app/js/directives.js
+++ b/app/js/directives.js
@@ -69,15 +69,15 @@ app.directive('pgLine', function () {
var lines = [];
scope.$watch('list', function(newPoints) {
console.log("update");
-angular.forEach(lines, function(line) {
- line.remove();
- });
+ angular.forEach(lines, function(line) {
+ line.remove();
+ });
if (newPoints) {
for (var i = 0; i < newPoints.length - 1; ++i) {
if (newPoints[i].selected) {
- var line = new paper.Path.Line(newPoints[i], newPoints[i+1]);
- line.strokeColor = 'red';
+ var line = paper.Path.Line(newPoints[i], newPoints[i+1]);
+ line.strokeColor = 'rgba(7,140,255,.6)';
line.strokeWidth = 2;
lines.push(line)
}
diff --git a/app/js/yt_musicsearch.js b/app/js/yt_musicsearch.js
index fcc52db..82ad741 100644
--- a/app/js/yt_musicsearch.js
+++ b/app/js/yt_musicsearch.js
@@ -18,12 +18,22 @@ function searchClicked()
document.documentElement.firstChild.appendChild(script);
}
-
- function newMusic(id)
+
+ var musicTimer;
+
+ function startSongWithDuration(id, duration)
{
$('#ytplayer').attr('src', 'https://www.youtube.com/embed/'+id+'?autoplay=1&modestbranding=1');
+ console.log("Starting music "+id+", timer="+duration);
+ musicTimer = setInterval(changeSong, duration * 1000);
}
-
+
+ function changeSong()
+ {
+ alert("Done");
+ clearInterval(musicTimer);
+ }
+
function getAllMatchingIds(data)
{
var feed = data.feed;
@@ -44,7 +54,7 @@ function searchClicked()
for (var i = 0; i < results.length; i++)
{
//html.push('<li>', '<img src="http://img.youtube.com/vi/', results[i].id, '/2.jpg" /><a href="#" onclick="newMusic(\'', results[i].id ,'\')">', results[i].title, '</a>(', results[i].duration, ')', '</li>');
- html.push('<li>', '<a href="#" onclick="newMusic(\'', results[i].id ,'\')">', results[i].title, '</a>', '</li>');
+ html.push('<li>', '<a href="#" onclick="startSongWithDuration(\'', results[i].id ,'\', '+results[i].duration +')">', results[i].title, '</a>', '</li>');
}
html.push('</ul>');
document.getElementById('videoResultsDiv').innerHTML = html.join('');
diff --git a/videosearch_n_play.html b/videosearch_n_play.html
index 8a8f854..fb58843 100644
--- a/videosearch_n_play.html
+++ b/videosearch_n_play.html
@@ -31,9 +31,18 @@
}
- function newMusic(id)
+ var songFinished;
+ function newMusic(id, duration)
{
$('#ytplayer').attr('src', 'https://www.youtube.com/embed/'+id+'?autoplay=1&modestbranding=1');
+ songFinished = setTimer(nextSong, duration * 1000);
+ console.log("Setting timer for "+duration+" seconds");
+ }
+
+ function nextSong()
+ {
+ clearTimer(songFinished);
+ console.log("Bingo !");
}
function getAllMatchingIds(data)
@@ -60,6 +69,8 @@
html.push('</ul>');
document.getElementById('videoResultsDiv').innerHTML = html.join('');
}
+
+
</script>