class Opal::Asciicast::ScreenRecorder

Overview

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

Defined in:

opal/asciicast/screen_recorder.cr

Constructors

Instance Method Summary

Constructor Detail

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

[View source]

Instance Method Detail

def active? : Bool #

[View source]
def 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.


[View source]
def current_time : Float64 #

[View source]
def frame_count : Int32 #

[View source]
def hold(seconds : Float64) : self #

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


[View source]
def last_captured_buffer : UI::Buffer | Nil #

[View source]
def output_path : String #

[View source]
def output_path=(output_path : String) #

[View source]
def pause : self #

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


[View source]
def paused? : Bool #

[View source]
def record(&block : ScreenRecorder -> Nil) : Nil #

Convenience scoped recording block. Automatically starts and stops recording.


[View source]
def recording? : Bool #

[View source]
def resume : self #

Resumes recording after being paused.


[View source]
def save(path : String | Nil = nil) : Nil #

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


[View source]
def 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).


[View source]
def 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.


[View source]
def skip_frames(count : Int32) : self #

Instructs the recorder to discard the next N captured frames.


[View source]
def skip_frames_remaining : Int32 #

[View source]
def skip_frames_remaining=(skip_frames_remaining : Int32) #

[View source]
def start : self #

Starts the recording session


[View source]
def stop : self #

Stops the recording session and saves the .cast file.


[View source]
def type_text(text : String, cps : Float64 = 25.0) : self #

Simulates human keystroke typing directly to the recording timeline.


[View source]
def wait_frames(count : Int32 = 1, delay_per_frame : Float64 = 0.05) : self #

Advances the recording timeline by simulating N frames.


[View source]
def write_terminal(data : String, delay : Float64 = 0.0) : self #

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


[View source]
def writer : Writer #

[View source]