diff --git a/light9/web/lib/bower.json b/light9/web/lib/bower.json
--- a/light9/web/lib/bower.json
+++ b/light9/web/lib/bower.json
@@ -13,7 +13,8 @@
"d3": "https://github.com/d3/d3.git#e7194db33090a0afc06c77a959594361ffb949df",
"rdflib.js": "https://github.com/linkeddata/rdflib.js.git#920e59fe37",
"rdfstore": "https://github.com/antoniogarrote/rdfstore-js.git#b3f7c0c9c1da9b26261af0d4858722fa982411bb",
- "N3.js": "https://github.com/RubenVerborgh/N3.js.git#04f4e21f4ccb351587dc00a3f26340b28d4bb10f"
+ "N3.js": "https://github.com/RubenVerborgh/N3.js.git#04f4e21f4ccb351587dc00a3f26340b28d4bb10f",
+ "shortcut": "http://www.openjs.com/scripts/events/keyboard_shortcuts/shortcut.js"
},
"resolutions": {
"paper-styles": "^1.1.4",
diff --git a/light9/web/light9-music.coffee b/light9/web/light9-music.coffee
--- a/light9/web/light9-music.coffee
+++ b/light9/web/light9-music.coffee
@@ -9,8 +9,10 @@ Polymer
turboSign: { type: String, notify: true }
duration: { type: Number, notify: true }
+ song: { type: String, notify: true }
+ # It does not yet work to write back to the playing/t
+ # properties. See seekPlayOrPause.
playing: { type: Boolean, notify: true }
- song: { type: String, notify: true }
t: { type: Number, notify: true }
ready: ->
@@ -23,6 +25,7 @@ Polymer
setTimeout(@poll.bind(@), 2000)
@poll()
setInterval(@estimateTimeLoop.bind(@), 50)
+
estimateTimeLoop: ->
if @playing
@@ -31,13 +34,15 @@ Polymer
@t = @remoteT
poll: ->
+ clearTimeout(@nextPoll) if @nextPoll
@$.getTime.generateRequest()
@status = "♫"
+
onResponse: ->
@status = " "
- r = @$.getTime.lastResponse
+ @lastResponse = @$.getTime.lastResponse
now = Date.now()
- if !r.playing && r.t != @remoteT
+ if !@lastResponse.playing && @lastResponse.t != @remoteT
# likely seeking in another tool
@turboUntil = now + 1000
if now < @turboUntil
@@ -47,14 +52,18 @@ Polymer
@turboSign = " "
delay = 700
- setTimeout(@poll.bind(@), delay)
- @duration = r.duration
- @playing = r.playing
- @song = r.song
+ @nextPoll = setTimeout(@poll.bind(@), delay)
+ @duration = @lastResponse.duration
+ @playing = @lastResponse.playing
+ @song = @lastResponse.song
- @remoteT = r.t
+ @remoteT = @lastResponse.t
@remoteAsOfMs = now
+ seekPlayOrPause: (t) ->
+ @$.seek.body = {t: t}
+ @$.seek.generateRequest()
-
+ @turboUntil = Date.now() + 1000
+ @poll()
diff --git a/light9/web/light9-music.html b/light9/web/light9-music.html
--- a/light9/web/light9-music.html
+++ b/light9/web/light9-music.html
@@ -15,6 +15,10 @@
}