Documentation
¶
Overview ¶
Package player includes an API to play back recorded sessions.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Clock clockwork.Clock Log logrus.FieldLogger SessionID session.ID Streamer Streamer }
Config configures a session player.
type Player ¶
type Player struct {
// contains filtered or unexported fields
}
Player is used to stream recorded sessions over a channel.
func (*Player) C ¶
func (p *Player) C() <-chan events.AuditEvent
C returns a read only channel of recorded session events. The player manages the timing of events and writes them to the channel when they should be rendered. The channel is closed when the player has reached the end of playback.
func (*Player) Err ¶
Err returns the error (if any) that occurred during playback. It should only be called after the channel returned by [C] is closed.
func (*Player) LastPlayed ¶
LastPlayed returns the time of the last played event, expressed as milliseconds since the start of the session.
func (*Player) Pause ¶
Pause temporarily stops the player from emitting events. It is a no-op if playback is currently paused.
func (*Player) Play ¶
Play starts emitting events. It is used to start playback for the first time and to resume playing after the player is paused.
func (*Player) SetPos ¶
SetPos sets playback to a specific time, expressed as a duration from the beginning of the session. A duration of 0 restarts playback from the beginning. A duration greater than the length of the session will cause playback to rapidly advance to the end of the recording.
func (*Player) SetSpeed ¶
SetSpeed adjusts the playback speed of the player. It can be called at any time (the player can be in a playing or paused state). A speed of 1.0 plays back at regular speed, while a speed of 2.0 plays back twice as fast as originally recorded. Valid speeds range from 0.25 to 16.0.