Skip to content

linux: fix offscreen media playback - #97

Open
sduguay-devolutions wants to merge 4 commits into
AvaloniaUI:mainfrom
Devolutions:fix/offscreen-media-playback
Open

sduguay-devolutions wants to merge 4 commits into
AvaloniaUI:mainfrom
Devolutions:fix/offscreen-media-playback

Conversation

@sduguay-devolutions

@sduguay-devolutions sduguay-devolutions commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Issue

With ExperimentalOffscreen on, video and audio never play. The page loads fine and
the element is there, it just never starts. The same page plays on the non-offscreen
adapter.

The offscreen adapter parents the web view in a GtkOffscreenWindow, and WebKit won't
start media when the toplevel is one. That decision is made inside WebKit from the
type of the toplevel.

Fix

Use a window that draws offscreen without being a GtkOffscreenWindow.
GtkOffscreenHostWindow registers a GObject type at runtime deriving from GtkWindow,
and in class_init copies the class-struct slots where GtkOffscreenWindow differs from
GtkWindow into its own class struct. Rendering is the same as before, but WebKit sees a
plain GtkWindow toplevel and media plays.

Before (nothing load):
image

After:
Screencast_20261013_164149.webm

@sduguay-devolutions sduguay-devolutions changed the title Fix/offscreen media playback linux: fix offscreen media playback Oct 13, 2026
@sduguay-devolutions
sduguay-devolutions marked this pull request as ready for review October 13, 2026 20:46

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant