class Opal::Asciicast::PlaybackEngine

Overview

Playback and inspection engine for Asciinema v2 recordings. Reconstructs terminal screens into UI::Buffer frames, supports frame-by-frame stepping, seeking, speed multipliers, and overlay-respecting compositing.

Defined in:

opal/asciicast/playback_engine.cr

Constructors

Instance Method Summary

Constructor Detail

def self.from_file(path : String) : self #

Factory constructor from file path


[View source]
def self.from_string(content : String) : self #

Factory constructor from raw asciicast string


[View source]
def self.new(recording : Reader::Recording) #

[View source]

Instance Method Detail

def add_overlay(element : UI::Element, x : Int32, y : Int32, width : Int32, height : Int32) : self #

Attaches a persistent overlay element to be composited over playback


[View source]
def clear_overlays : self #

Clears all persistent overlays


[View source]
def current_buffer : UI::Buffer #

Returns the current visual buffer


[View source]
def current_frame : PlaybackFrame #

Returns the current frame or a blank buffer if no frames exist


[View source]
def current_index : Int32 #

[View source]
def current_timestamp : Float64 #

Returns the current timestamp in seconds


[View source]
def duration : Float64 #

[View source]
def empty? : Bool #

[View source]
def frames : Array(PlaybackFrame) #

[View source]
def goto_frame(index : Int32) : PlaybackFrame #

Seeks directly to a frame index


[View source]
def has_next? : Bool #

[View source]
def has_prev? : Bool #

[View source]
def height : Int32 #

[View source]
def looping=(looping : Bool) #

[View source]
def looping? : Bool #

[View source]
def next_frame : PlaybackFrame #

Advances to the next frame


[View source]
def pause : self #

[View source]
def paused? : Bool #

[View source]
def play(speed : Float64 = 1.0, loop : Bool = false, &block : UI::Buffer, Int32 -> Nil) : Nil #

Automated playback loop yielding each frame buffer and frame index


[View source]
def playing? : Bool #

[View source]
def prev_frame : PlaybackFrame #

Steps back to the previous frame


[View source]
def recording : Reader::Recording #

[View source]
def render_frame(target : UI::Buffer, x : Int32 = 0, y : Int32 = 0, respect_overlays : Bool = false) : Nil #

Composites the current playback frame into the target buffer. If respect_overlays is true, does not overwrite non-space cells already in target.


[View source]
def resume : self #

[View source]
def rewind : PlaybackFrame #

Rewinds playback to frame 0


[View source]
def seek(timestamp_seconds : Float64) : PlaybackFrame #

Seeks to the frame closest to the specified timestamp in seconds


[View source]
def speed : Float64 #

[View source]
def speed=(speed : Float64) #

[View source]
def stop : self #

[View source]
def total_frames : Int32 #

[View source]
def width : Int32 #

[View source]