Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request]: allow frame drawing while unvisible #42140

Open
3 tasks done
HyrepBall opened this issue May 13, 2024 · 3 comments
Open
3 tasks done

[Feature Request]: allow frame drawing while unvisible #42140

HyrepBall opened this issue May 13, 2024 · 3 comments

Comments

@HyrepBall
Copy link

HyrepBall commented May 13, 2024

Preflight Checklist

Problem Description

In the video, Google Meet was used to reproduce the bug to clearly show the behavior of the application window in inactive mode
There was a bug with both BrowserView and WebContentsView

backgroundThrottling: false doesn't solve my problem.

First, I show the behavior of the application at the moment when it is broadcast via Google Meet, and as you can see, the counter has increased to 20, but should have shown the loaded site content at 15 seconds.
Then I showed the behavior of the application in its normal state, and after the required number of seconds the site was displayed correctly.

IMPORTANT! when I hovered the mouse over the application window at 20 seconds, at that moment the content was displayed in Google Meet, i.e. in this moment

Proposed Solution

Add the ability to render the application when it is minimized/out of focus

Alternatives Considered

or find a way to get around it

Additional Information

const { app, BrowserWindow, WebContentsView } = require("electron");
const path = require("node:path");

function createWindow() {
  const mainWindow = new BrowserWindow({
    width: 2000,
    height: 1100,
    webPreferences: {
      preload: path.join(__dirname, "preload.js"),
      backgroundThrottling: false,
    },
  });

  mainWindow.loadFile("index.html");

  // mainWindow.webContents.openDevTools();

  const view1 = new WebContentsView({
    webPreferences: {
      backgroundThrottling: false,
    },
  });
  mainWindow.contentView.addChildView(view1);

  setTimeout(() => {
    view1.webContents.loadURL("https://electronjs.org");
  }, 15000);

  view1.setBounds({ x: 0, y: 0, width: 2000, height: 1100 });
}

app.whenReady().then(() => {
  createWindow();
});

app.on("window-all-closed", function () {
  if (process.platform !== "darwin") app.quit();
});
@HyrepBall
Copy link
Author

20240508141827.mp4

@HyrepBall
Copy link
Author

HyrepBall commented May 13, 2024

Here is the code that made it clear that the application was not working correctly
https://discord.com/channels/745037351163527189/1233319793852157984/1237738439844167710

download them into same folder

index.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <h3>index.html LOADED</h3>
    <h3 id="test"></h3>

    <script>
        setTimeout(()=>{
            console.log("Change location")
            location.href = "./index2.html"
        }, 5000)

        function step(timestamp) {
            
            document.querySelector('#test').textContent =  performance.now()
            
            window.requestAnimationFrame(step);
        }

        window.requestAnimationFrame(step);

    </script>
</body>
</html>

index2.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <h3>index.html2 LOADED</h3>
    <h3 id="test"></h3>

    <script>
        setTimeout(()=>{
            console.log("Change location")
            location.href = "./index.html"
        }, 5000)

        function step(timestamp) {
            
            document.querySelector('#test').textContent =  performance.now()
            
            window.requestAnimationFrame(step);
        }

        window.requestAnimationFrame(step);
    </script>
</body>
</html>

@HyrepBall
Copy link
Author

20240508154638.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant