diff options
Diffstat (limited to 'pages/present.tsx')
-rw-r--r-- | pages/present.tsx | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/pages/present.tsx b/pages/present.tsx index f8f6bc9..ad3cec2 100644 --- a/pages/present.tsx +++ b/pages/present.tsx @@ -51,10 +51,21 @@ class TimedVideoPlayer { jumpToSlide(slide: slide) { this.jumpToFrame(slide.frame); - this.player.playbackRate = this.framerate / ((slide as speedChangeSlide).newFramerate || this.framerate); + this.player.playbackRate = this.getPlaybackSpeed(this.slide); this.player.pause(); } + getPlaybackSpeed(slide: number) { + for (var i = slide; i > -1; i--) { + var previousSlide = this.timeline.slides[i]; + if (previousSlide.type != 'speedChange') { + continue; + } + return this.framerate / (previousSlide as speedChangeSlide).newFramerate; + } + return 1; + } + handleSlide(slide: slide) { switch (slide.type) { case 'loop': { @@ -62,10 +73,10 @@ class TimedVideoPlayer { break; } case 'delay': { - this.jumpToSlide(slide); + this.player.playbackRate = 0; this.slide++; setTimeout(() => { - this.player.play(); + this.player.playbackRate = this.getPlaybackSpeed(this.slide - 1); }, (slide as delaySlide).delay); break; } |