thomaswp / snap-replay

"Video"-like replayer for Snap logs
1 stars 1 forks source link

Fast-forward and rewind playback issue #3

Open cvetelinandreev opened 2 years ago

cvetelinandreev commented 2 years ago

Seeking at random position is slow and produces different result

This is what the turtle draws if I fast forward in the middle of the lesson image

This is what the turtle draws at the same position in the lesson without FF image

If I FF closer to the end, it gets worse. Seems like sync issue.

For a reference: If I execute a log file with 131 commands (move and turn right/left) and timeDelta: 50 between each of them, the result is different than the expected. If I increase timeDelta to 100, then it is fine.

Attached is a sample project to test with.

project.zip

thomaswp commented 2 years ago

I tried out your test file. Wow, that's some complex code for a first video! I'm actually impressed it replicates as well as it does.

As for failing to reproduce the drawings perfectly, it could be a number of issues, given the complexity of the code you're running, but I'm seeing a TIMEOUT warning. This means that when fastforwarding the code you're running is taking longer than 300ms, even in turbo mode. This may be because you're using blocks I haven't tested with that don't work in turbo mode, or because you have a forever loop or something like that. I'll play around with this a bit, but if you can figure out exactly what's causing those TIMEOUT messages (e.g. what command) that would be helpful.

As for it being slow, that's the result of just trying to replay so much. The best solution to this is creating milestones along the way, i.e. saving xml snapshots of the code every 30-60s, and then reloading from the most recent snapshot. In theory this could be very straightforward, but I'm guessing it could cause a number of issues that will require some time to fix.

thomaswp commented 2 years ago

In the meantime, I recommend keeping videos to ~5m, and breaking them up. This is good for students and good for editing as well.

cvetelinandreev commented 2 years ago

OK. Let's do this way: 1) I'll break the lesson into 2. The second demo goes in another lesson so there will be less for replaying 2) I'll debug the timeouts. I suspect the block 'say ... for 4 sec' might be more than 300 ms ...

On Thu, Jan 27, 2022 at 11:23 PM Thomas Price @.***> wrote:

In the meantime, I recommend keeping videos to ~5m, and breaking them up. This is good for students and good for editing as well.

— Reply to this email directly, view it on GitHub https://github.com/thomaswp/snap-replay/issues/3#issuecomment-1023651524, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACYL3KTGYNSIC6TJNWTWHCDUYGZW3ANCNFSM5MVQE7BA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you authored the thread.Message ID: @.***>

cvetelinandreev commented 2 years ago

The TIMEOUT warnings led to the the issue. The majority of them happen after playback of executions of 2 of my custom blocks - save and draw. Both of them use image. I switched getting the user input as a block parameter instead of a blocking popup and now the issue is gone. Attached: noaskandwait.zip

There are two TIMEOUTs still there: 1) after the IDE.greenFlag at the beginning 2) after a custom block execution that executes about 131 commands

I don't always get the second one, though it is clear why there is a TIMEOUT. I'll make the example simpler and this will go away.

The first TIMEOUT doesn't seem to cause any issues and it is not related to my particular project. See the attached timeout.zip.

cvetelinandreev commented 2 years ago

One note.

The 'ask and wait' block works better when demonstrating user input. It is somehow more realistic - event are playbacked on each key press. On my lesson I can even hear the keyboard clicking and see the input changing at the same time.

There is a workaround, but it requires manually changing the log file.

However I prefer smooth fast forward than realistic user input.