hlsplay

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2026 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Overview

Package hlsplay measures client-observed playback through Plex HTTP handlers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadReference

func LoadReference(path string) ([]splicecheck.Segment, []time.Duration, error)

LoadReference reads a prior hlsplay report and resolves its artifact paths.

Types

type Attempt

type Attempt struct {
	Origin                         string // scheme and host only; excludes credentials, path and query
	Kind                           string
	Index                          int
	RequestedAt                    time.Time
	ElapsedSeconds                 float64
	Status, Bytes                  int
	SHA256                         string
	FirstByteSeconds, TotalSeconds float64
	Try                            int
	Error                          string `json:",omitempty"`
}

type Buffer

type Buffer struct {
	Level, Played float64
	Started       bool
	Stalls        []Stall
	// contains filtered or unexported fields
}

Buffer is driven by a monotonic clock, including time spent blocked in HTTP. Initial buffering is startup latency. After playback begins, every empty interval is a stall, including a terminal interval with no subsequent fetch.

func (*Buffer) Add

func (b *Buffer) Add(now, duration float64)

func (*Buffer) Advance

func (b *Buffer) Advance(now float64)

type Config

type Config struct {
	SegmentBarrierDir                                               string
	PauseBeforeIndex                                                int
	ReencodedAudio                                                  bool
	DecisionOrigin, StartOrigin, StopOrigin                         string
	ReferenceTimeline                                               []time.Duration
	Protocol, Prefix, CredentialsFile, DeviceID                     string
	DirectPlay, DirectStream                                        bool
	SkipDecision                                                    bool
	PrivateHTTP                                                     bool
	MaxVideoBitrate                                                 int
	VideoResolution                                                 string
	ProducerEvidence                                                string
	BaseURL, Token, RatingKey, Output, Session, Host                string
	Window, ForwardBuffer, RequestTimeout, Backoff, SegmentDuration time.Duration
	Tries                                                           int
	FFmpeg, FFprobe                                                 string
	Reference                                                       []splicecheck.Segment
}

type Continuity

type Continuity struct {
	Verified bool
	Error    string
	Report   splicecheck.Report
}

type Report

type Report struct {
	Barrier                                      *SegmentBarrier `json:",omitempty"`
	PlaybackStarted                              bool
	ReencodedAudio                               bool
	ControlOriginsPinned                         bool
	InitialTimeline                              []time.Duration
	InitialPlaylistSHA256                        string
	Protocol                                     string
	DecisionSkipped                              bool
	Session                                      string
	StartedAt                                    time.Time
	StartupSeconds, ElapsedSeconds               float64
	Outcome, Error                               string
	WindowComplete, IndicesExact, PlaybackPassed bool
	Segments                                     []Segment
	Attempts                                     []Attempt
	Buffer                                       []Sample
	Stalls                                       []Stall
	Retries                                      int
	Continuity                                   Continuity
}

func Run

func Run(ctx context.Context, c Config) (r Report, err error)

Run writes durable, credential-free events and JSON/Markdown outcomes, including failed sessions. The output directory must be new. Callers supply a lab token.

type Sample

type Sample struct{ ElapsedSeconds, BufferedSeconds, PlayedSeconds float64 }

type Segment

type Segment struct {
	Index                  int
	Path                   string
	DurationSeconds        float64
	ReceivedAt             time.Time
	Status, Bytes, Retries int
	SHA256                 string
	FirstByteSeconds       float64
	// Generation is unknown unless a trusted server observer supplies it.
	Generation uint64
}

type SegmentBarrier

type SegmentBarrier struct {
	Session           string    `json:"session"`
	Index             int       `json:"index"`
	LastReceivedIndex int       `json:"lastReceivedIndex"`
	PlaylistSHA256    string    `json:"playlistSHA256"`
	ReadyAt           time.Time `json:"readyAt"`
	ReleasedAt        time.Time `json:"releasedAt,omitempty"`
}

type Stall

type Stall struct {
	StartSeconds    float64
	DurationSeconds float64
}

Jump to

Keyboard shortcuts

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