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.
- Go 1.22+
- libmpv development headers (
libmpv-dev/media-video/mpvwithlibmpvUSE)
The Fyne fork carrying canvas.GLVideo is a git submodule, so clone
recursively:
git clone --recursive https://github.com/uidbz/fyne-mpv-video.gitIf you already cloned without --recursive:
git submodule update --initDesktop OpenGL (X11 or XWayland):
go build
./fyne-mpv-video test.mp4Native Wayland with EGL/GLES only (e.g. a libglvnd built without X):
go build -tags "wayland egl gles gles2"
./fyne-mpv-video test.mp4You can pass any local file or URL that mpv can open.