Story speed change bug
Bukii opened this issue · 1 comments
Expected Behavior
If you change the speed of the replay, it should play faster/slower. Starting from the same timestamp.
Example: If I change to 2x at 0:17 it should move twice as fast starting from 0:17.
Current Behavior
If you change to let's say 2x at 0:17, the story's current position in time changes to where the story would be, if it had been played at 2x from the beginning.
Here's a short video, which is showing the bug
Steps to Reproduce
- Open VSCode, click on the "S" icon and open a random's user's story.
- While watching the story, click on of those speed options.
The finalMs doesn't change at all I dunno if is the only bug in there, but it looks very suspicious to me.
If you have 3x, and hit replay, then 2x while is playing you can see the whole period that is waiting to put the next letter, but if you select a faster speed it just jumps and finish quickly. We might also have to reassign playBackDateStart
when speed is changed.
Basically when the speed is changed all variables should readjust, start time and end time should get recalculated, then start from the same position when you hit the speed button as you've mentioned. Might also need ms
to change according to speed. text-utils.ts
might have some bugs too. But well this bug might be low priority until gif feature is released.
Edit 1: The loop length should also change accordingly.
const playBackDateStart = new Date().getTime();
const finalMs = recordingSteps[recordingSteps.length - 1][0];
let i = 0;
while (i < recordingSteps.length) {
const [ms, changeBlock] = recordingSteps[i];
const currentDuration =
(new Date().getTime() - playBackDateStart) * speed;
if (currentDuration < ms) {
progress.set(currentDuration / finalMs);
await sleep(10);
continue;
}
executeChanges(textChunks, changeBlock);
textChunks = textChunks;
i++;
}