feat(cef): allow UI audio without a user gesture (autoplay-policy)#234
feat(cef): allow UI audio without a user gesture (autoplay-policy)#234JEssou115 wants to merge 2 commits into
Conversation
CEF views here are host-driven overlays (notifications, HUD, menus) that never receive a real user activation, so Chromium's default autoplay policy silently blocks all sound — both Web Audio (AudioContext stays suspended) and <audio> playback. Opt the embedded browser out with --autoplay-policy=no-user-gesture-required so resources can play UI sounds. There's no page-side workaround for a passive overlay: it never gets a gesture and synthetic events don't count as activation. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughThe CEF command-line setup now adds ChangesCEF autoplay configuration
Estimated code review effort: 1 (Trivial) | ~2 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Not sure about this one. I think this should be an opt-in feature that the multiplayer client would enable selectively. Then, each multiplayer client should ideally have a settings menu where this feature can be enabled or disabled. This is to avoid potential abuse on malicious servers. We shouldn't trust the user-generated content that much. |
What
Adds one Chromium switch in
App::OnBeforeCommandLineProcessing:Why
CEF views here are host-driven overlays (notifications, HUD, menus). They're rendered by the game and never receive a real user activation (a trusted click/keypress in the page). Chromium's default autoplay policy requires that activation before any audio can play, so all UI sound is silently blocked — both Web Audio (
AudioContext.resume()stays suspended) and<audio>playback.There is no page-side workaround for a passive overlay: it never gets a gesture, and synthetic events don't count as user activation. The autoplay policy is a global command-line switch (not a per-view setting), so this flag is the standard fix — and it enables notification/UI sounds for any resource.
Notes
disable-gpu-compositing,disable-extensions, …).🤖 Generated with Claude Code
Summary by CodeRabbit