asciinema / asciinema

Terminal session recorder 📹

Home Page:https://asciinema.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Please provide mechanism to identify end of cast files

shrkamat opened this issue · comments

First of all this is not a but instead a feature request.

It will be great if there is a tag to indicate end of cast files. This feature can be useful real-time casting is to be supported. Currently playback would end if there is no more entries in cast file.

{"version": 2, "width": 101, "height": 46, "timestamp": 1649945007, "env": {"SHELL": "/bin/bash", "TERM": "screen-256color"}}
[1.866198, "o", "v"]
[2.010452, "o", "i"]
[2.060719, "o", "m"]
[2.264262, "o", " "]
.
.
.
.
{"event": "eof-cast"}

Instead the player could wait for eof-cast event to occur to end asciinema playback.

You can already treat the end of file (file closing when you read from it) as the end of the stream. I don't see a point in adding an explicit indicator...

Well at any point of time if it's required to live stream cast files over network, then without eof-cast event there is no way to identify if cast has ended (at client side).

If client side were to use file eof, player would end the cast playback prematurely.

You can see this happening if you attempt to playback a rec in progress cast file.

But can't you just close the stream at the end to signal an EOF? Or if you already building a protocol, you can just add your own control markers.

What you're describing @shrkamat is a higher level indicator, specific to the way streaming is implemented. IMO this doesn't belong in the on-disk file format, but rather in your own protocol as @Gerifield suggested.