diff --git a/browser-client.cpp b/browser-client.cpp index 1083793a1..06aab7143 100644 --- a/browser-client.cpp +++ b/browser-client.cpp @@ -606,6 +606,17 @@ bool BrowserClient::GetAudioParameters(CefRefPtr browser, CefAudioPa return true; } +void BrowserClient::OnLoadStart(CefRefPtr browser, CefRefPtr frame, TransitionType) +{ + if (!valid()) { + return; + } + + if (reroute_audio && frame->IsMain()) { + browser->GetHost()->SetAudioMuted(true); + } +} + void BrowserClient::OnLoadEnd(CefRefPtr, CefRefPtr frame, int) { if (!valid()) { diff --git a/browser-client.hpp b/browser-client.hpp index 069c3ff42..851ee4eb7 100644 --- a/browser-client.hpp +++ b/browser-client.hpp @@ -144,6 +144,8 @@ class BrowserClient : public CefClient, virtual bool GetAudioParameters(CefRefPtr browser, CefAudioParameters ¶ms) override; /* CefLoadHandler */ + virtual void OnLoadStart(CefRefPtr browser, CefRefPtr frame, + TransitionType transition_type) override; virtual void OnLoadEnd(CefRefPtr browser, CefRefPtr frame, int httpStatusCode) override; virtual void OnLoadError(CefRefPtr browser, CefRefPtr frame,