Skip to content

[v3][Linux][GTK3] getUserMedia is denied by default because WebKitGTK permission-request is not handled #5552

@jalfdev

Description

@jalfdev

Description

On Linux with Wails v3 GTK3, frontend calls to navigator.mediaDevices.getUserMedia() for camera or microphone are denied by WebKitGTK by default.

The frontend receives:

NotAllowedError: The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission.

This happens even when the Linux user has OS-level access to /dev/video* and audio devices.

From debugging, WebKitGTK emits a permission-request signal for WebKitUserMediaPermissionRequest, but the current Wails v3 GTK3 wrapper does not appear to handle or expose this signal. Because nobody handles the request, WebKitGTK rejects it by default.

Environment

  • Wails: v3.0.0-alpha.97
  • Platform: Linux / UOS Desktop 25 Professional
  • Backend: Go 1.25.5
  • GTK3: 3.24.41
  • WebKitGTK 4.1: 2.50.4
  • libsoup 3.0: 3.6.5

Reproduction

  1. Build a Wails v3 GTK3 app on Linux.
  2. In the frontend, call:
await navigator.mediaDevices.getUserMedia({ video: true })

or:

await navigator.mediaDevices.getUserMedia({ audio: true })
  1. The call fails with NotAllowedError.

Current workaround

We patched pkg/application/linux_cgo_gtk3.go locally to handle WebKitGTK permission-request and allow only WebKitUserMediaPermissionRequest:

static gboolean allow_media_permission_request(WebKitWebView *web_view, WebKitPermissionRequest *request, gpointer user_data) {
    (void)web_view;
    (void)user_data;
    if (WEBKIT_IS_USER_MEDIA_PERMISSION_REQUEST(request)) {
        webkit_permission_request_allow(request);
        return TRUE;
    }
    return FALSE;
}

static void connect_media_permission_request(GtkWidget *webview) {
    g_signal_connect(webview, "permission-request", G_CALLBACK(allow_media_permission_request), NULL);
}

Then after creating the WebKit web view:

webView := C.webkit_web_view_new_with_user_content_manager(manager)
C.connect_media_permission_request(webView)

After this patch, camera and microphone access work.

Expected behavior

Wails v3 should provide a supported way to handle WebKitGTK permission requests on Linux, especially for camera and microphone access.

Possible solutions:

  • Allow WebKitUserMediaPermissionRequest by default for app-local frontend content.
  • Expose a permission callback in Wails window/application options.
  • Add a Linux GTK3-specific API to configure media permission behavior.

Why this matters

Desktop apps using Wails v3 on Linux/UOS may need camera or microphone access for face login, video capture, voice input, WebRTC, etc. Without a permission handler, those features fail even though OS-level device permissions are correctly configured.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't workingLinuxv3

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions