Documentation
¶
Overview ¶
Package player is Ulka's video player: the look and controls a library chooses (settings), and what the embedded player fetches to render itself. The player is Shaka Player in the console's web app; this module is its service. It reads libraries and playback ids only through video's Go functions.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Docs = video.PlayerDocs{ Clean: func(raw []byte) ([]byte, error) { in := defaults() dec := json.NewDecoder(bytes.NewReader(raw)) dec.DisallowUnknownFields() if err := dec.Decode(&in); err != nil { return nil, errInvalidPlayer } if err := in.validate(); err != nil { return nil, err } return json.Marshal(in) }, View: func(stored []byte) any { return settingsOf(stored) }, Config: serveConfig, }
Docs is what the video module needs to store and show a workspace's default player settings.
var Templates = []Template{ {"standard", "Standard", "Every control: speed, quality, captions, picture in picture, full screen and 10-second skips. For most videos and lessons.", standard}, {"minimal", "Minimal", "Play, the timeline, volume and full screen; nothing else. For product videos and short clips.", Behaviour{Controls: true, Captions: true, Fullscreen: true}}, {"preview", "Preview", "Starts by itself without sound and repeats, with simple controls to unmute or watch. For teasers and previews.", Behaviour{Controls: true, Autoplay: true, Muted: true, Loop: true, Captions: true, Fullscreen: true}}, {"background", "Background", "No controls; starts by itself without sound and repeats. For a moving background on a website.", Behaviour{Autoplay: true, Muted: true, Loop: true}}, }
Templates are the uses most videos fall into, first the default.
Functions ¶
Types ¶
type Behaviour ¶
type Behaviour struct {
Controls bool `json:"controls"` // off: no controls at all, for a page that drives the player or a background
Autoplay bool `json:"autoplay"` // browsers only allow it with the sound off
Loop bool `json:"loop"`
Muted bool `json:"muted"`
Speed bool `json:"speed"`
Quality bool `json:"quality"`
Captions bool `json:"captions"`
Pip bool `json:"pip"`
Fullscreen bool `json:"fullscreen"`
Skip int `json:"skip"` // seconds the back and forward buttons move; 0 hides them
}
Behaviour is which controls show and how playback starts: the part a template sets.
type Settings ¶
type Settings struct {
Accent string `json:"accent"` // #rrggbb: the progress bar, buttons and the play button
Theme string `json:"theme"` // dark or light controls
LogoURL string `json:"logo_url"`
LogoLink string `json:"logo_link"`
Behaviour
}
Settings is how a library's videos look when played with Ulka's player (Shaka Player underneath). One document per library; the console edits it and the embedded player reads it.