videoplay

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2026 License: Apache-2.0 Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package videoplay tracks app and platform ownership of a video’s playback.

Index

Constants

View Source
const Background = -1

Background is the backend's own reason for a pause because the app went to the background, which Changed reports as VideoPauseInterruption. No audio-session interruption ends it, so it never lets the video resume, and it takes back the resume of an interruption that paused the video before.

Variables

This section is empty.

Functions

This section is empty.

Types

type State

type State struct {
	// Playing is what the player did last, as far as the backend knows.
	Playing bool
	// Completed holds a non-repeating end until an explicit replay or seek.
	Completed bool
	// contains filtered or unexported fields
}

State follows who decides whether a video's player plays. The app's Paused applies when it changes and when a source opens; between changes the platform's controls and the system may pause or play the player, and the player then keeps their state, not Paused, until Paused changes. Each such change is reported once, as EventVideoPause with its reason or EventVideoPlay.

func (*State) Applied

func (p *State) Applied(playing bool)

Applied records the play state the backend is about to give the player, which is not reported.

func (*State) Changed

func (p *State) Changed(playing, paused bool, reason int) (driver.Event, bool)

Changed takes a play state the player reached on its own, from its controls or the system, with paused the app's Paused, and returns the event that reports it. reason is the pause's, unless the system gave one before. A pause for an audio-session interruption may resume when the interruption ends.

func (*State) Configure

func (p *State) Configure(pausedChanged bool) bool

Configure reports whether to apply the app’s Paused: when it changed, or no native control or completed frame holds the play state.

func (*State) Ended

func (p *State) Ended(repeat bool, at time.Duration)

Ended records that the player reached its end, which EventEnd reports. A video that repeats plays on from its start, and whoever held its play state keeps it, so a play from the controls while Paused is true goes on; one that does not stops, leaves the play state to Paused again, and stays at its end through unrelated configuration until Paused changes, a seek or the controls play it; at is where it stopped.

func (*State) Expect

func (p *State) Expect(reason int)

Expect records why the system is about to pause the player, before the player says it stopped.

func (*State) Resume

func (p *State) Resume() bool

Resume says whether the player plays again as an interruption that paused it ends: when the system lets it, and the app has not changed Paused since.

func (*State) Rewinds

func (p *State) Rewinds(at time.Duration) bool

Rewinds says whether the app's play of a completed video starts over from the beginning, with at the player's position: it does while the player is still where it ended, and resumes where the platform's controls scrubbed it back to otherwise. The end the player reached is the mark, not the item's duration, which a player's end may fall short of.

Jump to

Keyboard shortcuts

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