Documentation
¶
Overview ¶
Package video plays video files and streams with the system's own media framework, for ui.Video to show: AVFoundation on macOS, Media Foundation on Windows, GStreamer on Linux and the video element in browsers. The system decodes the video, in hardware where it can, and plays its sound in sync with the picture; its frames reach the window's renderer where the decoder left them, on the GPU, without a copy through memory where the system allows it.
//go:embed trailer.mp4 var trailer []byte app.trailer, err = video.OpenData(trailer) ... ui.Video(c, app.trailer).Fill().Fit(ui.Contain)
A video opens at once and loads in the background: the player is not Ready, and its Size is 0×0, until its first picture came, which builds a frame of the window that shows it, as a change of its state does. What formats play is the system's: H.264 and AAC in MP4 or MOV play on all of them; HEVC, VP9 and AV1 where the system has their decoders, and HLS streams on macOS, Windows and browsers.
Apps that do not import the package link none of it. GIFs and animated PNGs play without it, decoded in Go (ui.NewGIFDecoder, ui.NewAPNGDecoder), on every system.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrUnsupported = errors.New("video: the system has no media framework that plays video")
ErrUnsupported reports a system without a media framework that plays video: a Linux without GStreamer 1.x and its base plugins, or an OS of none. An app may show a GIF in its place.
Functions ¶
func Open ¶
func Open(path string) (*ui.VideoPlayer, error)
Open opens a video file, playing once a Video shows it.
Types ¶
This section is empty.