Changeset - d7ea6d473bf6
[Not reviewed]
default
0 1 0
drewp@bigasterisk.com - 6 years ago 2019-06-10 23:15:55
drewp@bigasterisk.com
don't let <video> play and get corrected when we're out of bounds, which made a bad flicker
Ignore-this: 2eb8ea8a5399b7ccd00841654ff620f0
1 file changed with 4 insertions and 0 deletions:
0 comments (0 inline, 0 general)
light9/web/light9-vidref-replay.js
Show inline comments
 
@@ -24,24 +24,28 @@ class Light9VidrefReplay extends LitElem
 
        const x0 = Math.round(n * .3);
 
        const x1 = Math.round(n * .6);
 
        const pt0 = this.songToVideo[x0];
 
        const pt1 = this.songToVideo[x1];
 
        return (pt1[1] - pt0[1]) / (pt1[0] - pt0[0]);
 
    }
 
    setVideoTimeFromSongTime(songTime, isPlaying) {
 
        if (!this.songToVideo || !this.outVideo || this.outVideo.readyState < 1) {
 
            return;
 
        }
 
        const i = _.sortedIndex(this.songToVideo, [songTime],
 
                                (row) => { return row[0]; });
 
        if (i == 0 || i > this.songToVideo.length - 1) {
 
            isPlaying = false;
 
        }
 
        
 
        this.videoTime = this.songToVideo[Math.max(0, i - 1)][1];
 

	
 
        this.outVideoCurrentTime = this.outVideo.currentTime;
 
        
 
        if (isPlaying) {
 
            if (this.outVideo.paused) {
 
                this.outVideo.play();
 
                this.setRate(this.estimateRate());
 
            }
 
            const err = this.outVideo.currentTime - this.videoTime;
 
            this.timeErr = err;
 

	
0 comments (0 inline, 0 general)