Changeset - c8f0d1b9a171
[Not reviewed]
default
0 3 0
drewp@bigasterisk.com - 6 years ago 2019-06-09 04:45:24
drewp@bigasterisk.com
timeline scrubbing shows up on vidref (again)
Ignore-this: 62d3c7ffc411949e211c6e286f551b55
3 files changed with 31 insertions and 5 deletions:
0 comments (0 inline, 0 general)
bin/vidref
Show inline comments
 
@@ -100,16 +100,29 @@ class SnapshotPic(cyclone.web.StaticFile
 
    pass
 

	
 

	
 
class Time(cyclone.web.RequestHandler):
 
class Time(PrettyErrorHandler, cyclone.web.RequestHandler):
 

	
 
    def put(self):
 
        body = json.loads(self.request.body)
 
        t = body['t']
 
        source = body['source']
 
        self.settings.gui.incomingTime(t, source)
 
        for listener in TimeStream.time_stream_listeners:
 
            listener.sendMessage(json.dumps({
 
                'st': t,
 
                'song': body['song'],
 
            }))
 
        self.set_status(202)
 

	
 

	
 
class TimeStream(cyclone.websocket.WebSocketHandler):
 
    time_stream_listeners = []
 

	
 
    def connectionMade(self, *args, **kwargs):
 
        TimeStream.time_stream_listeners.append(self)
 

	
 
    def connectionLost(self, reason):
 
        TimeStream.time_stream_listeners.remove(self)
 

	
 

	
 
class Clips(PrettyErrorHandler, cyclone.web.RequestHandler):
 

	
 
    def delete(self):
 
@@ -174,6 +187,7 @@ reactor.listenTCP(
 
                "path": 'todo',
 
            }),
 
            (r'/time', Time),
 
            (r'/time/stream', TimeStream),
 
            (r'/stats/(.*)', StatsHandler, {
 
                'serverName': 'vidref'
 
            }),
light9/web/light9-vidref-replay-stack.js
Show inline comments
 
@@ -35,7 +35,7 @@ class Light9VidrefReplayStack extends Li
 
            const sinceLastUpdate = (Date.now() - this.musicState.reportTime) / 1000;
 
            this.songTime = sinceLastUpdate + this.musicState.tStart;
 
        } else  {
 
            this.songTime = this.musicState.t;
 
            // this.songTime = this.musicState.t;
 
        }
 
        requestAnimationFrame(this.fineTime.bind(this));
 
    }
 
@@ -51,6 +51,7 @@ class Light9VidrefReplayStack extends Li
 

	
 
        const ws = reconnectingWebSocket('../ascoltami/time/stream',
 
                                         this.receivedSongAndTime.bind(this));
 
        reconnectingWebSocket('time/stream', this.receivedRemoteScrubbedTime.bind(this));
 
        // bug: upon connecting, clear this.song
 
        this.fineTime();
 
    }
 
@@ -67,6 +68,17 @@ class Light9VidrefReplayStack extends Li
 
            this.getReplayMapForSong(this.song);
 
        }
 
    }
 

	
 
    receivedRemoteScrubbedTime(msg) {
 
        this.songTime = msg.st;
 

	
 
        // This doesn't work completely since it will keep getting
 
        // updates from ascoltami slow updates.
 
        if (msg.song != this.song) {
 
            this.song = msg.song;
 
            this.getReplayMapForSong(this.song);
 
        }
 
    }
 
        
 
    getReplayMapForSong(song) {
 
        const u = new URL(window.location.href);
light9/web/timeline/timeline.coffee
Show inline comments
 
@@ -215,7 +215,7 @@ coffeeElementSetup(class TimelineEditor 
 
  sendMouseToVidref: ->
 
    now = Date.now()
 
    if (!@$.vidrefLastSent? || @$.vidrefLastSent < now - 200) && !@songPlaying
 
      @$.vidrefTime.body = {t: @viewState.latestMouseTime(), source: 'timeline'}
 
      @$.vidrefTime.body = {t: @viewState.latestMouseTime(), source: 'timeline', song: @song}
 
      @$.vidrefTime.generateRequest()
 
      @$.vidrefLastSent = now
 

	
0 comments (0 inline, 0 general)