player

package
v1.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 1, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Player

type Player struct {
	emu.Terminal
	// contains filtered or unexported fields
}

func FromEvents

func FromEvents(events []sessions.Event) *Player

func FromEventsContext added in v1.2.0

func FromEventsContext(
	ctx context.Context,
	events []sessions.Event,
) (*Player, error)

FromEventsContext creates a Player from the given events, but stops if the context is cancelled.

func New

func New(options ...detect.Option) *Player

func (*Player) Acquire

func (p *Player) Acquire()

func (*Player) Commands

func (p *Player) Commands() []detect.Command

func (*Player) Events

func (p *Player) Events() []sessions.Event

func (*Player) Goto

func (p *Player) Goto(index, offset int)

Goto moves the player to the specified event index and byte offset. If the index and offset are before the current location, the player will reset the terminal and start from the beginning, since there's no way to "rewind" a terminal session. This means that playing backwards is very slow on long sessions.

func (*Player) GotoProgress added in v0.10.0

func (p *Player) GotoProgress(
	index, offset int,
	progress chan<- int,
)

GotoProgress is the same as Goto, but it allows for a progress channel to be passed in. The channel will receive progress updates as the player moves through the events.

func (*Player) Location

func (p *Player) Location() search.Address

func (*Player) Output added in v0.9.0

func (p *Player) Output(start, end int) (data []byte, ok bool)

Output gets all of the output written in the range [start, end).

func (*Player) Preview

func (p *Player) Preview(
	params *params.Parameters,
	viewport, location geom.Vec2,
	highlights []movement.Highlight,
) *tty.State

Preview captures a preview with the size `viewport` at `location` in the scrollback of the terminal. You may also provide `highlights` that will be passed to the Flow renderer. Returns nil if the player is "in use", which is only used by replay mode to jump back in time.

func (*Player) Process

func (p *Player) Process(event sessions.Event) error

func (*Player) Release

func (p *Player) Release()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL