diff --git a/CMakeLists.txt b/CMakeLists.txt index 4662a84bc..a6c9952f7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,7 +36,6 @@ target_sources( deps/wide-string.cpp deps/wide-string.hpp obs-browser-plugin.cpp - obs-browser-source-audio.cpp obs-browser-source.cpp obs-browser-source.hpp) diff --git a/browser-app.cpp b/browser-app.cpp index 7a6c893a9..5d2c4dc76 100644 --- a/browser-app.cpp +++ b/browser-app.cpp @@ -122,14 +122,7 @@ void BrowserApp::OnContextCreated(CefRefPtr browser, CefRefPtrSetValue(name, func, V8_PROPERTY_ATTRIBUTE_NONE); } -#if !ENABLE_WASHIDDEN - int id = browser->GetIdentifier(); - if (browserVis.find(id) != browserVis.end()) { - SetDocumentVisibility(browser, browserVis[id]); - } -#else UNUSED_PARAMETER(browser); -#endif } void BrowserApp::ExecuteJSFunction(CefRefPtr browser, const char *functionName, CefV8ValueList arguments) @@ -158,81 +151,6 @@ void BrowserApp::ExecuteJSFunction(CefRefPtr browser, const char *fu } } -#if !ENABLE_WASHIDDEN -void BrowserApp::SetFrameDocumentVisibility(CefRefPtr browser, CefRefPtr frame, bool isVisible) -{ - UNUSED_PARAMETER(browser); - - CefRefPtr context = frame->GetV8Context(); - - context->Enter(); - - CefRefPtr globalObj = context->GetGlobal(); - - CefRefPtr documentObject = globalObj->GetValue("document"); - - if (!!documentObject) { - documentObject->SetValue("hidden", CefV8Value::CreateBool(!isVisible), V8_PROPERTY_ATTRIBUTE_READONLY); - - documentObject->SetValue("visibilityState", CefV8Value::CreateString(isVisible ? "visible" : "hidden"), - V8_PROPERTY_ATTRIBUTE_READONLY); - - std::string script = "new CustomEvent('visibilitychange', {});"; - - CefRefPtr returnValue; - CefRefPtr exception; - - /* Create the CustomEvent object - * We have to use eval to invoke the new operator */ - bool success = context->Eval(script, frame->GetURL(), 0, returnValue, exception); - - if (success) { - CefV8ValueList arguments; - arguments.push_back(returnValue); - - CefRefPtr dispatchEvent = documentObject->GetValue("dispatchEvent"); - - /* Dispatch visibilitychange event on the document - * object */ - dispatchEvent->ExecuteFunction(documentObject, arguments); - } - } - - context->Exit(); -} - -void BrowserApp::SetDocumentVisibility(CefRefPtr browser, bool isVisible) -{ - /* This method might be called before OnContextCreated - * call is made. We'll save the requested visibility - * state here, and use it later in OnContextCreated to - * set initial page visibility state. */ - browserVis[browser->GetIdentifier()] = isVisible; - - std::vector frameIdentifiers; - /* Set visibility state for every frame in the browser - * - * According to the Page Visibility API documentation: - * https://developer.mozilla.org/en-US/docs/Web/API/Page_Visibility_API - * - * "Visibility states of an