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

Browser window inconsistent state with respect to FullScreen API #1904

Closed
frankhale opened this issue Jun 8, 2015 · 5 comments
Closed

Browser window inconsistent state with respect to FullScreen API #1904

frankhale opened this issue Jun 8, 2015 · 5 comments

Comments

@frankhale
Copy link
Contributor

Just a bit of background to set the stage: I use a webview in my app to embed YouTube videos.

I compiled Electron from master on the 3rd of June and the fullscreen button in the embedded YouTube player was working very well without any extra code on my part.

Now that 0.27.3 has shipped the fullscreen button in the embedded player no longer works. I think it may be because of this commit: 8f9a109

Are app writers supposed to do something special to allow fullscreen now?

@frankhale
Copy link
Contributor Author

I'm a dork! It would have helped if I just took 10 minutes to read through the patch and then look at the docs for webview. I'd have noticed enter-html-full-screen, leave-html-full-screen. I added some handlers to my webview and then call setFullScreen accordingly. Life is peachy again!!!!

@frankhale
Copy link
Contributor Author

There is some foo going on with respect to leaving fullscreen. I'm not going to reopen this just yet but leaving fullscreen leaves the YouTube player in a state that it still thinks it's in fullscreen. This still may be an issue with the patch mentioned above because it was working prior to the code changes.

@frankhale frankhale reopened this Jun 8, 2015
@frankhale
Copy link
Contributor Author

I'm reopening this because I think there is still something wrong with fullscreen API changes that happened in 8f9a109. I'll provide an example before the night is over.

@frankhale frankhale changed the title Embedded YouTube player fullscreen not working in 0.27.3 but used to Browser window inconsistent state with respect to FullScreen API Jun 9, 2015
@frankhale
Copy link
Contributor Author

Okay here is a small example that demonstrates the browser window inconsistent state after entering and leaving fullscreen.

When running this, click the fullscreen button on the embedded YouTube player. You'll go into fullscreen as you'd expect. Click the fullscreen button again and you'll leave fullscreen. Try clicking the fullscreen button again the fullscreen events have stopped propagating.

One thing to keep in mind is that this worked as expected just a few days ago when I built from master with absolutely no extra code, "It Just Worked(tm)" out of the box. This does not work in 0.27.2.

The main.js and package.json are standard text book, nothing special so I won't post them here.

<!DOCTYPE html>
<html>

  <head>
    <title>Webview Fullscreen Test</title>
    <style>
      body {
        margin:0;
        overflow: hidden;
      }
      #webview {
        position:absolute;
        width: 100%;
        height: 100%;
      }
    </style>
  </head>

  <body>
    <webview id="webview" src="http://www.youtube.com/embed/GxfwZMdSt4w?autoplay=1"></webview>

    <script type="text/javascript">
      var remote = require('remote');
      var browser = remote.getCurrentWindow();
      //browser.openDevTools();

      var webview = document.getElementById("webview");
      webview.addEventListener("enter-html-full-screen", function() {
        browser.setFullScreen(true);
      });
      webview.addEventListener("leave-html-full-screen", function() {
        browser.setFullScreen(false);
      });
    </script>
  </body>

</html>

@frankhale
Copy link
Contributor Author

I compiled from master to test this out and it works very well. Thank you!

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

2 participants