video

command
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2026 License: MIT Imports: 16 Imported by: ? 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.

README

Video

Install libmpv 0.37 or later, then run:

go run ./examples/video -danmaku /path/to/video.mp4
go run ./examples/video 'https://example.org/stream.m3u8'

The window accepts a local path or URL and has a file picker, pause control, position readout and danmaku toggle. The overlay reuses outlined text sprites at the window's physical scale.

Create the player with video.Options{Video: true}. Use ui.Video(c, player, layout.Grow(1)).Radius(c.Theme.RadiusLG).Body(fn) to place custom controls and overlays over it. Call player.Close() when its window closes. A player belongs to one video view. On Windows and Linux, an initial Open can be queued while the GPU surface starts. Check video.Event errors from OnEvent and rendering failures from player.VideoError().

The time readout follows video.Progress. Ordinary progress updates are coalesced at a 250 ms interval by default. Use video.Changed for playback state such as pause and dimensions. ui.Video schedules picture updates independently of either event.

macOS uses Metal to sample the IOSurface produced by libmpv's CGL context. The default window switches to Metal when it first receives a video frame. Linux uses GtkGLArea OpenGL. With a software GL driver, run the example with TANGO_RENDERER=gpu to enable Tango's OpenGL window.

Windows tries native D3D11 first and falls back to software rendering and BGRA upload when needed. -software selects the software path explicitly. Pass -libmpv to load a library from another location. The Windows loader checks alongside the executable and the macOS loader checks the app bundle and Homebrew. Linux uses the system's libmpv.so.2.

Use -diagnostics to print playback and submission counters. A submission counts a new video generation sent through the UI presentation path.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

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