And another project that uses a similar approach (but as far as I can tell, doesn't use plain script files):
https://asciinema.org/
One benefit with scriptreplayjs is that you could just download the script-file and play it pack with script/scriptreplay (the former under BSD (and Linux?), the latter (only) under Linux, if I read the man-pages right).
And the fact that the script is (mostly) text -- so it should be easy to make it copy-pasteable...
I suppose it should be possible to patch either project to overlay key presses...
[edit: Might be cool to hack this tool to work with regular script logs -- so it could generate gifs, or other tools could be used for js "playback"? ]
Unfortunately, script is probably not usable here:
From the github page:
specifically, I wrote this with the forthcoming Vim Stack Exchange site in mind
From the script docu:
Certain interactive commands, such as vi(1), create garbage in the typescript file.
script works best with commands that do not manipulate the screen, the results are meant
to emulate a hardcopy terminal.
Other than that, I'm inclined to have a look at op's code to see if one might break out the gif-encoding to a sepearate bit -- and "encode" for js/html playback (as well, or in place of) video/gif.
Years ago I rewrote rxvt in javascript. https://github.com/paddymul/rxvt-js my aim was to create a terminalcast recording site. my rxvt implementation doesn't work with color, but it can succesfully redisplay an emacs session with split windows.
Please, hack on the code, this is something that should exist.
And the fact that the script is (mostly) text -- so it should be easy to make it copy-pasteable...
I suppose it should be possible to patch either project to overlay key presses...
https://www.freebsd.org/cgi/man.cgi?query=script(1)&sektion= http://man7.org/linux/man-pages/man1/scriptreplay.1.html
https://packages.debian.org/wheezy/bsdutils
[edit: Might be cool to hack this tool to work with regular script logs -- so it could generate gifs, or other tools could be used for js "playback"? ]