Sound Attenuation for Web Browser

Hey guys i have built a web browser in my project and put it on a wall. So the thing that i wanted to do is when i play a video on Youtube then i walk away from that wall i want that sound of that video to decrease depending on the distance. I am looking in forums for hours still can’t find a solution for my problem.

You can only do it with C++:

I’m not sure about what CEF version was used for older UE, but for UE 5.2.1 and higher you can implement an audio handler with CEF. Usually you have to modify the engine for this, but personally I couldn’t afford that so I just copied the WebBrowser module in my ueproject, renamed the module and some headers that caused some errors. I then implemented CefAudioHandler from cef_audio_handler.h in FCEFBrowserHandler (original file Engine/Source/Runtime/WebBrowser/Private/CEF/CEFBrowserHandler.h). CefAudioHandler gives PCM data (read more here). I fed that data to a USoundWaveProcedural with the according conversions and then I simply played it with an AudioComponent which can then be assigned sound attenuation options.

I had only one issue which seems to be known, the CefAudioHandler doesn’t kick in instantly so there’s a short time in which you still hear the browser’s audio directly to your audio output but I fixed that by muting the browser in FCEFBrowserHandler’s OnAfterCreated with Browser->GetHost()->SetAudioMuted(true)