class

Opal::Asciicast::ScreenRecorder

Inherits Reference < Object

Screen recorder that captures Opal::UI::Buffer frames directly into standard Asciinema v2 (.cast) files without flicker or terminal diff artifacts.

Constructors

new(output_path : String, width : Int32 = 80, height : Int32 = 24, title : String = "Opal Session", term : String = "xterm-256color", writer : Writer | Nil = nil)
Source

Instance methods

active?
Source
capture_frame(buffer : UI::Buffer, advance : Float64 | Nil = nil) : Bool

Captures a screen buffer frame directly. If advance is not specified, calculates elapsed wall-clock time since last frame.

Source
current_time
Source
frame_count
Source
hold(seconds : Float64) : self

Freezes/holds the current visual frame for a given number of seconds in playback.

Source
last_captured_buffer
Source
output_path
Source
output_path=(output_path : String)
Source
pause

Pauses recording. Subsequent frame captures are ignored until resume is called.

Source
paused?
Source
record

Convenience scoped recording block. Automatically starts and stops recording.

Source
recording?
Source
resume

Resumes recording after being paused.

Source
save(path : String | Nil = nil) : Nil

Saves the recording to disk. If path is provided, overrides @output_path.

Source
screenshot(path : String | Nil = nil, format : Symbol = :ansi, buffer : UI::Buffer | Nil = nil, copy_to_clipboard : Bool = false) : String

Captures a screenshot of the last recorded frame (or the passed buffer).

Source
screenshot_to_clipboard(format : Symbol = :text, buffer : UI::Buffer | Nil = nil) : String

Captures a screenshot of the last recorded frame and copies it to the system clipboard.

Source
skip_frames(count : Int32) : self

Instructs the recorder to discard the next N captured frames.

Source
skip_frames_remaining
Source
skip_frames_remaining=(skip_frames_remaining : Int32)
Source
start

Starts the recording session

Source
stop

Stops the recording session and saves the .cast file.

Source
type_text(text : String, cps : Float64 = 25.0) : self

Simulates human keystroke typing directly to the recording timeline.

Source
wait_frames(count : Int32 = 1, delay_per_frame : Float64 = 0.05) : self

Advances the recording timeline by simulating N frames.

Source
write_terminal(data : String, delay : Float64 = 0.0) : self

Writes raw terminal output or control sequences directly to the recording timeline.

Source
writer
Source