Skip to content

feat(webview): mute page audio in place - #1247

Merged
houko merged 5 commits into
nsgo-dev:mainfrom
houko:feat/webview-mute-114
Nov 21, 2026
Merged

houko merged 5 commits into
nsgo-dev:mainfrom
houko:feat/webview-mute-114

Conversation

@houko

@houko houko commented Nov 21, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Add WebView.Muted, MutedFunc, and the reactive TSX muted prop. Changes apply to the mounted view and persist across navigations.
  • Windows and Linux silence the whole web view with WebView2 and WebKitGTK. macOS 12 and iOS 15 or later suspend and resume media with the public WKWebView API. WebView2 · WebKitGTK · WKWebView
  • Add a mute checkbox and a test tone to the gallery. The desktop regressions wait for native load events from two local HTTP pages and check mute state on the same view across navigation.

Refs #114. UserAgentSuffix and ClearWebsiteData are already on main. Android provider support remains on the roadmap. Other WebView hosts keep their usual playback.

Verification

  • go tool nsgo check -target macos,ios,ios_simulator,windows,linux,web -jobs 3 passed for all nine targets. macOS arm64 and x64 passed again after the child-window changes. The branch was rebased onto de61b9fa5 with the upstream accessibility, navigation, and platform changes. The gallery media and Linux native mute tests passed again after reconciling the gallery's new WebView controls.
  • Five focused checks passed for the core configuration, the reactive TSX prop, the gallery demo, the public API, and the skill.
  • macOS WKWebView played a local audio element, suspended it, kept it suspended across navigation, and resumed it after clearing mute in three runs.
  • Windows WebView2 passed three independent native runs in an interactive session. Linux WebKitGTK passed five native runs under Xvfb with an isolated D-Bus session. Both checked initial mute, mute after navigation, and unmute on the same native view.
  • The previous Linux PipeWire capture measured both a video track and a Web Audio tone before muting and after unmuting. Both were silent while muted, including after navigation, while the page's media element still reported its own muted property as false.
  • Windows audio output capture and iOS playback verification remain open.

@github-actions github-actions Bot added enhancement New feature or request size/M documentation Improvements or additions to documentation macOS iOS Windows Linux core tsx conflict Conflicts with the base branch; resolve it first labels Nov 21, 2026
@houko
houko force-pushed the feat/webview-mute-114 branch from 179c4c1 to 07e2905 Compare November 21, 2026 07:14
@github-actions github-actions Bot added conflict Conflicts with the base branch; resolve it first and removed conflict Conflicts with the base branch; resolve it first labels Nov 21, 2026
@houko
houko force-pushed the feat/webview-mute-114 branch from 07e2905 to b8d55d3 Compare November 21, 2026 17:15
@github-actions github-actions Bot removed the conflict Conflicts with the base branch; resolve it first label Nov 21, 2026
@houko
houko force-pushed the feat/webview-mute-114 branch from b8d55d3 to f7e4f7c Compare November 21, 2026 17:46
@houko

houko commented Nov 21, 2026

Copy link
Copy Markdown
Collaborator Author

Reviewed.

  • Read the full diff against [Feature] Web view: mute a page's audio, clear the stored website data, and append to the platform's user agent #114's mute acceptance criteria. Windows uses ICoreWebView2_8::put_IsMuted (vtable slot 84 and the IID match the WebView2 IDL), Linux uses webkit_web_view_set_is_muted (always present in WebKitGTK 6.0), and Apple uses the public setAllMediaPlaybackSuspended:completionHandler: behind respondsToSelector:, with the limitation stated in the field doc. Each host applies the value on its first configure, so a view mounted muted starts muted. MutedFunc follows the existing SourceFunc render-effect pattern and keeps the same native view.
  • Checked that the tests fail without the fix: with the MutedFunc effect removed, TestWebViewConfiguresLoadsAndReports and TestWebViewMutedFollowsItsProp fail, and with the Apple suspend call disabled, TestWebMuteSuspendsMedia fails. All of them pass with the fix.
  • Ran core, tsx and the gallery's TestMedia on Linux, vetted Linux and Windows, compiled the Linux and Windows test binaries, and vetted Apple code for macOS and iOS. The macOS WebKit test passes on a Mac.
  • Rebased onto main and unwrapped the new hard-wrapped comments onto single lines. No behavior change.
  • Android has no implementation yet. The roadmap row tracks it.

@houko
houko enabled auto-merge (rebase) November 21, 2026 17:46
@github-actions github-actions Bot added the conflict Conflicts with the base branch; resolve it first label Nov 21, 2026
@houko
houko force-pushed the feat/webview-mute-114 branch 3 times, most recently from 5e42ced to 7fd24b3 Compare November 21, 2026 19:15
@github-actions github-actions Bot removed conflict Conflicts with the base branch; resolve it first labels Nov 21, 2026
@houko
houko force-pushed the feat/webview-mute-114 branch from 7fd24b3 to 3cbfe8b Compare November 21, 2026 21:28
@houko
houko merged commit f0a0591 into nsgo-dev:main Nov 21, 2026
10 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core documentation Improvements or additions to documentation enhancement New feature or request iOS Linux macOS size/M tsx Windows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant