https://github.com/xakep666/asciinema-player
A simple player for asciinema v2 (https://github.com/asciinema/asciinema) casts
https://github.com/xakep666/asciinema-player
ascii asciicast asciinema cast go golang lib mit player terminal tool util
Last synced: 4 months ago
JSON representation
A simple player for asciinema v2 (https://github.com/asciinema/asciinema) casts
- Host: GitHub
- URL: https://github.com/xakep666/asciinema-player
- Owner: xakep666
- License: mit
- Created: 2018-06-29T07:25:16.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2023-11-02T21:35:29.000Z (over 2 years ago)
- Last Synced: 2024-06-21T18:09:25.175Z (almost 2 years ago)
- Topics: ascii, asciicast, asciinema, cast, go, golang, lib, mit, player, terminal, tool, util
- Language: Go
- Size: 1.05 MB
- Stars: 17
- Watchers: 3
- Forks: 6
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# asciinema-player
[](https://github.com/xakep666/asciinema-player/actions/workflows/testing.yml)
[](https://codecov.io/gh/xakep666/asciinema-player)
[](https://goreportcard.com/report/github.com/xakep666/asciinema-player)
[](https://pkg.go.dev/github.com/xakep666/asciinema-player/v3)
[](https://opensource.org/licenses/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:
```bash
go get -v -u github.com/xakep666/asciinema-player
```
App:
```bash
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`
[](https://asciinema.org/a/189343)
### Library
```go
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](./example/togif)
[Web-based player for server-stored casts](./example/webplayer)
## License
Asciinema-player project is licensed under the terms of the MIT license. Please see LICENSE in this repository for more details.