Skip to content

xakep666/asciinema-player

Repository files navigation

asciinema-player

Build Status codecov Go Report Card Go Reference License: MIT

asciinema-player is a library and cli-app to play terminal sessions recorded by asciinema (http://github.com/asciinema/asciinema)

Prerequisites

  • Golang >= 1.17

Installation

Library:

go get -v -u github.com/xakep666/asciinema-player

App:

go get -v -u github.com/xakep666/asciinema-player/cmd/asciinema-player

Usage

App

$ ./asciinema-player --help
  Usage of ./asciinema-player:
    -f string
          path to asciinema v2 file
    -maxWait duration
          maximum time between frames (default 2s)
    -speed float
          speed adjustment: <1 - increase, >1 - decrease (default 1)

For example you can play test session ./asciinema-player -f test.cast

asciicast

Library

frameSource, err := player.NewStreamFrameSource(reader)
if err != nil {
    return err
}

term, err := player.NewOSTerminal()
if err != nil {
    return err
}

defer term.Close()

player, err := player.NewPlayer(frameSource, terminal)
if err != nil {
    return err
}

err = player.Play()
if err != nil {
    return err
}

Library usage example is app, actually.

Examples

Renderer to GIF Web-based player for server-stored casts

License

Asciinema-player project is licensed under the terms of the MIT license. Please see LICENSE in this repository for more details.