aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2021-05-14 11:17:43 +0200
committerlonkaars <loek@pipeframe.xyz>2021-05-14 11:17:43 +0200
commit45ba5f546b27de69a8134c04c354226711af080c (patch)
treecdf1727d85878becff0e1a49360dd92b8f613fc2
parent2afd08139151c392ca1eff3356b4ad60750e1c8f (diff)
skip delay keyframe
-rw-r--r--pages/present.tsx17
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;
}