diff --git a/light9/web/light9-music.coffee b/light9/web/light9-music.coffee new file mode 100644 --- /dev/null +++ b/light9/web/light9-music.coffee @@ -0,0 +1,29 @@ +log = console.log + +# port of light9/curvecalc/musicaccess.py +Polymer + is: "light9-music", + properties: + status: { type: String, notify: true } + duration: { type: Number, notify: true } + playing: { type: Boolean, notify: true } + song: { type: String, notify: true } + t: { type: Number, notify: true } + ready: -> + @$.getTime.addEventListener('response', @onResponse.bind(@)) + @$.getTime.addEventListener 'error', (e) => + req = @$.getTime.lastRequest + @status = "GET "+req.url+ " -> " + req.status + " " + req.statusText + setTimeout(@poll.bind(@), 2000) + @poll() + poll: -> + @$.getTime.generateRequest() + @status = "poll" + onResponse: -> + @status = "ok" + setTimeout(@poll.bind(@), 1000) + r = @$.getTime.lastResponse + @duration = r.duration + @playing = r.playing + @song = r.song + @t = r.t diff --git a/light9/web/light9-music.html b/light9/web/light9-music.html new file mode 100644 --- /dev/null +++ b/light9/web/light9-music.html @@ -0,0 +1,11 @@ + + + + + + + + diff --git a/light9/web/timeline-elements.html b/light9/web/timeline-elements.html --- a/light9/web/timeline-elements.html +++ b/light9/web/timeline-elements.html @@ -2,6 +2,7 @@ +