Godot Version
4.3.stable.official
Question
Hi everyone!
I’m exporting a game with Godot 4.3 (Web) and I want to automatically mute all audio when the browser tab is switched or minimized.
I’ve tried using _notification(NOTIFICATION_WM_FOCUS_OUT) and DisplayServer.window_has_focus(), but they don’t work in the web export.
I also added a visibilitychange listener using JavaScriptBridge.eval(), but couldn’t get it to properly call a GDScript function.
Could someone please share a reliable method or example of how to detect document.visibilitychange in a Godot Web export and call a GDScript function (e.g. mute_audio())?
I’d really appreciate any help! ![]()