[GH-ISSUE #393] Presentation mode, for playing back keystrokes when pressing keys #859

Closed
opened 2026-03-15 10:46:26 +03:00 by kerem · 15 comments
Owner

Originally created by @skorokithakis on GitHub (Feb 28, 2020).
Original GitHub issue: https://github.com/asciinema/asciinema/issues/393

This is a bit of a weird request, but asciinema would be extremely useful in presentations if it could play back my keystrokes when I actually pressed keys, to make it look like I'm live-typing.

Ie it would record when I pressed keys during the recording, and advance the playback from keystroke to keystroke when I pressed any key on the keyboard.

Is this possible to do with the current format/code? If not, what would I need to change to implement this? Any pointers would be appreciated.

Originally created by @skorokithakis on GitHub (Feb 28, 2020). Original GitHub issue: https://github.com/asciinema/asciinema/issues/393 This is a bit of a weird request, but asciinema would be extremely useful in presentations if it could play back my keystrokes when I actually pressed keys, to make it look like I'm live-typing. Ie it would record when I pressed keys during the recording, and advance the playback from keystroke to keystroke when I pressed any key on the keyboard. Is this possible to do with the current format/code? If not, what would I need to change to implement this? Any pointers would be appreciated.
kerem closed this issue 2026-03-15 10:46:31 +03:00
Author
Owner

@skorokithakis commented on GitHub (Feb 28, 2020):

I have hacked together an implementation of this here:

https://github.com/asciinema/asciinema/compare/develop...skorokithakis:develop

Would anyone be interested in it? It works quite well, though it might need some more features before being releasable, but I can work on it some more if there's interest.

<!-- gh-comment-id:592284712 --> @skorokithakis commented on GitHub (Feb 28, 2020): I have hacked together an implementation of this here: https://github.com/asciinema/asciinema/compare/develop...skorokithakis:develop Would anyone be interested in it? It works quite well, though it might need some more features before being releasable, but I can work on it some more if there's interest.
Author
Owner

@ahillio commented on GitHub (Mar 2, 2020):

Oh that's exciting. I look forward to trying this out :)

<!-- gh-comment-id:593170884 --> @ahillio commented on GitHub (Mar 2, 2020): Oh that's exciting. I look forward to trying this out :)
Author
Owner

@skorokithakis commented on GitHub (Mar 2, 2020):

It works rather well, unfortunately it has some disadvantages for presentations, eg if you're writing code you can't switch to another window and run it, as it's all a recording, and you can't pause and resume, or easily edit the commands.

I'm looking into using the methods used by asciinema to create a player that will read a list of commands from a file and type them into a terminal as you type, with options to take over, skip forward/back, see the next commands, etc.

I might post here if there's interest, though it would probably be a separate tool so there's not much sense spamming this issue with that.

<!-- gh-comment-id:593175199 --> @skorokithakis commented on GitHub (Mar 2, 2020): It works rather well, unfortunately it has some disadvantages for presentations, eg if you're writing code you can't switch to another window and run it, as it's all a recording, and you can't pause and resume, or easily edit the commands. I'm looking into using the methods used by asciinema to create a player that will read a list of commands from a file and type them into a terminal as you type, with options to take over, skip forward/back, see the next commands, etc. I might post here if there's interest, though it would probably be a separate tool so there's not much sense spamming this issue with that.
Author
Owner

@ahillio commented on GitHub (Mar 2, 2020):

Could pause/resume be added back with the functionality you've demonstrated in this patch?

My zsh config has vi-mode and it'd be awesome for a recording to show the keys that are pressed in vi-mode.

I just tried your patch by cloning your repo with the Implement wait-for-keys commit and then from inside that directory using python3 -m asciinema rec testfile.cast but I didn't see any indication of the key presses when doing python3 -m asciinema play testfile.cast. Is there a way to toggle the keystroke indication? Or was I testing it incorrectly?

<!-- gh-comment-id:593189276 --> @ahillio commented on GitHub (Mar 2, 2020): Could pause/resume be added back with the functionality you've demonstrated in this patch? My zsh config has vi-mode and it'd be awesome for a recording to show the keys that are pressed in vi-mode. I just tried your patch by cloning your repo with the `Implement wait-for-keys` commit and then from inside that directory using `python3 -m asciinema rec testfile.cast` but I didn't see any indication of the key presses when doing `python3 -m asciinema play testfile.cast`. Is there a way to toggle the keystroke indication? Or was I testing it incorrectly?
Author
Owner

@skorokithakis commented on GitHub (Mar 2, 2020):

The functionality can certainly be added back, I just removed it to test. The keystrokes don't currently show, this PR is just for only playing the input when pressing keys.

You need to record with --stdin for this to work, by the way.

<!-- gh-comment-id:593257441 --> @skorokithakis commented on GitHub (Mar 2, 2020): The functionality can certainly be added back, I just removed it to test. The keystrokes don't currently show, this PR is just for only playing the input when pressing keys. You need to record with `--stdin` for this to work, by the way.
Author
Owner

@ahillio commented on GitHub (Mar 13, 2020):

I still plan to try this feature again with your recent suggestion.

I'm also curious to see this possible other project you mentioned and wonder if/how it may be similar/different from https://github.com/sloria/doitlive...?

<!-- gh-comment-id:598780035 --> @ahillio commented on GitHub (Mar 13, 2020): I still plan to try this feature again with your recent suggestion. I'm also curious to see this possible other project you mentioned and wonder if/how it may be similar/different from https://github.com/sloria/doitlive...?
Author
Owner

@skorokithakis commented on GitHub (Mar 13, 2020):

I have tried doitlive and it only worked with the shell and ipython. I used asciinema's terminal code to make It's a Live:

https://gitlab.com/stavros/itsalive

Thanks to asciinema, It's a Live works on every program (nesting two It's a Live sessions possibly doesn't work well though). It also includes a curses-based presenter view, pausing/resuming and other shortcuts.

<!-- gh-comment-id:598787705 --> @skorokithakis commented on GitHub (Mar 13, 2020): I have tried doitlive and it only worked with the shell and ipython. I used asciinema's terminal code to make It's a Live: https://gitlab.com/stavros/itsalive Thanks to asciinema, It's a Live works on every program (nesting two It's a Live sessions possibly doesn't work well though). It also includes a curses-based presenter view, pausing/resuming and other shortcuts.
Author
Owner

@nrktkt commented on GitHub (Mar 17, 2022):

I'd love a version of this where you can set pause/breakpoints in the recording. I don't need to show one character of the recording for every key I press, just to automatically pause the playback at specified points and resume on some command (keypress, press play, whatever)

<!-- gh-comment-id:1071832981 --> @nrktkt commented on GitHub (Mar 17, 2022): I'd love a version of this where you can set pause/breakpoints in the recording. I don't need to show one character of the recording for every key I press, just to automatically pause the playback at specified points and resume on some command (keypress, press play, whatever)
Author
Owner

@skorokithakis commented on GitHub (Mar 17, 2022):

@nrktkt It's a Live can already do that.

<!-- gh-comment-id:1071834825 --> @skorokithakis commented on GitHub (Mar 17, 2022): @nrktkt It's a Live can already do that.
Author
Owner

@nrktkt commented on GitHub (Mar 17, 2022):

@skorokithakis thanks for that realtime response
It's a Live requires you to actually run the commands in the terminal though right? ie. you couldn't playback in the browser

<!-- gh-comment-id:1071869410 --> @nrktkt commented on GitHub (Mar 17, 2022): @skorokithakis thanks for that realtime response It's a Live requires you to actually run the commands in the terminal though right? ie. you couldn't playback in the browser
Author
Owner

@skorokithakis commented on GitHub (Mar 17, 2022):

@nrktkt Ah, yes, it does need the terminal, correct. You want playback to keep playing on its own until you pause? It can't do that, I'm afraid... I thought you meant the opposite, i.e. type out the entire command with one key press.

<!-- gh-comment-id:1071873174 --> @skorokithakis commented on GitHub (Mar 17, 2022): @nrktkt Ah, yes, it does need the terminal, correct. You want playback to keep playing on its own until you pause? It can't do that, I'm afraid... I thought you meant the opposite, i.e. type out the entire command with one key press.
Author
Owner

@nrktkt commented on GitHub (Mar 18, 2022):

I'd want something halfway between asciinema and It's a Live. So both the input and output are pre-recorded (like asciinema), but with the ability to pause before each command (like It's a Live).
So if I were to present, I wouldn't need to use my computer to do the presentation

<!-- gh-comment-id:1071886031 --> @nrktkt commented on GitHub (Mar 18, 2022): I'd want something halfway between asciinema and It's a Live. So both the input and output are pre-recorded (like asciinema), but with the ability to pause before each command (like It's a Live). So if I were to present, I wouldn't need to use my computer to do the presentation
Author
Owner

@skorokithakis commented on GitHub (Mar 18, 2022):

Hmm, I think you may be able to fairly easily hack Asciinema to pause before the start of each line of input and wait for a keypress.

<!-- gh-comment-id:1071887426 --> @skorokithakis commented on GitHub (Mar 18, 2022): Hmm, I think you may be able to fairly easily hack Asciinema to pause before the start of each line of input and wait for a keypress.
Author
Owner

@nrktkt commented on GitHub (Mar 18, 2022):

I'd need some pointers on that. Would I be editing asciinema's source or doing something with my terminal recording or?

<!-- gh-comment-id:1071909998 --> @nrktkt commented on GitHub (Mar 18, 2022): I'd need some pointers on that. Would I be editing asciinema's source or doing something with my terminal recording or?
Author
Owner

@skorokithakis commented on GitHub (Mar 18, 2022):

Yeah, you'd have to modify the source, I think.

<!-- gh-comment-id:1072664599 --> @skorokithakis commented on GitHub (Mar 18, 2022): Yeah, you'd have to modify the source, I think.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/asciinema#859
No description provided.