Skip to content

Repository files navigation

fyne-mpv-video

A working demo of video playback inside a Fyne window, including on Wayland — by embedding libmpv through its OpenGL Render API instead of the classic (Wayland-incompatible) child-window --wid embedding.

The video is rendered by mpv into an offscreen OpenGL framebuffer that Fyne's GL painter then composites like any other texture, so the same code works on X11, Wayland, macOS and Windows.

This demo drives the canvas.GLVideo primitive proposed for Fyne upstream (see fyne-io/fyne#449). Until that lands, the fork that carries it is included as a git submodule at ./fyne, and go.mod has replace fyne.io/fyne/v2 => ./fyne.

See DOCUMENTATION.md for a complete, top-to-bottom explanation of the approach, the frame flow, and every file.

Requirements

  • Go 1.22+
  • libmpv development headers (libmpv-dev / media-video/mpv with libmpv USE)

Get the code

The Fyne fork carrying canvas.GLVideo is a git submodule, so clone recursively:

git clone --recursive https://github.com/uidbz/fyne-mpv-video.git

If you already cloned without --recursive:

git submodule update --init

Build & run

Desktop OpenGL (X11 or XWayland):

go build
./fyne-mpv-video test.mp4

Native Wayland with EGL/GLES only (e.g. a libglvnd built without X):

go build -tags "wayland egl gles gles2"
./fyne-mpv-video test.mp4

You can pass any local file or URL that mpv can open.

About

Embedding mpv Video in Fyne

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages