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

please anyone tell how to get the webview content in fullscreen in webgl #863

Open
wafer004 opened this issue Dec 5, 2022 · 8 comments
Open

Comments

@wafer004
Copy link

wafer004 commented Dec 5, 2022

please anyone tell how to get the webview content in fullscreen in webgl,

I want it in android also but first i want it in webgl, just guide anyone please.

@KojiNakamaru
Copy link
Member

(The following is confirmed for 2021.3.11f1)

For PC, you can click the bottom right blue button to show the content in fullscreen:

image

For mobiles, it is automatically shown in fullscreen.

@wafer004
Copy link
Author

wafer004 commented Dec 6, 2022

thanks for reply, but i have disabled the buttons and i want only content part in full screen not blue are around, please tell me how to do that

@KojiNakamaru
Copy link
Member

Unfortunately, as noted below, fullscreen mode requires a user interaction.

https://developer.mozilla.org/en-US/docs/Web/API/Element/requestFullscreen#security

@wafer004
Copy link
Author

wafer004 commented Dec 6, 2022

ok

Unfortunately, as noted below, fullscreen mode requires a user interaction.

https://developer.mozilla.org/en-US/docs/Web/API/Element/requestFullscreen#security

okay let me try this, and for now its coming like this screenshot and i want this in full screen
image

@KojiNakamaru
Copy link
Member

If you want to set every margin to zero, you can do so with webViewObject.SetMargins(0, 0, 0, 0);

@wafer004
Copy link
Author

wafer004 commented Dec 6, 2022

If you want to set every margin to zero, you can do so with webViewObject.SetMargins(0, 0, 0, 0);

i have already set the set the margin in above screenshot to zero, but i want the webview in full screen that is being showed in center.

@KojiNakamaru
Copy link
Member

Please try the following sample

https://github.com/gree/unity-webview/tree/example-for-859/sample

which is discussed in #859 (comment) .

If you set each margin to zero at https://github.com/gree/unity-webview/blob/example-for-859/sample/Assets/Scripts/SampleWebView.cs#L151 , the following is achieved.

image

@jeeteshb
Copy link

jeeteshb commented Jun 8, 2023

Hi @wafer004 I know its too late

  • Open the below index.html file and make below amendment /Applications/Unity/Hub/Editor/2018.4.13f1/PlaybackEngines/WebGLSupport/BuildTools/WebGLTemplates/Default/index.html

  • Under the below function. You can see that the unityInstance.SetFullscreen(1) is inside the onClick event function. Put it outside the onClick to make it default to full screen.

script.onload = () => {
        createUnityInstance(canvas, config, (progress) => {
          progressBarFull.style.width = 100 * progress + "%";
        }).then((unityInstance) => {
          loadingBar.style.display = "none";
          fullscreenButton.onclick = () => {
            unityInstance.SetFullscreen(1);
          };
        }).catch((message) => {
          alert(message);
        });
      };

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

No branches or pull requests

3 participants