Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

UniWebView - Integrating WebView to your mobile games in a simple way

Discussion in 'Assets and Asset Store' started by onevcat, Nov 14, 2013.

  1. gcscreations

    gcscreations

    Joined:
    Mar 8, 2018
    Posts:
    2
    i made to open google maps inside web view working well in unity android but it's not well in IOS

    Errors for iOS build:
    [1164:197717] Could not signal service com.apple.WebKit.Networking: 113: Could not find specified service

    if anyone know abt this issue please help me..
     
    jiatee likes this.
  2. RyanYN

    RyanYN

    Joined:
    Aug 13, 2013
    Posts:
    20
    i want send a string value to H5 page, how to use "EvaluatingJavaScript"?
    the demo 6.RunJavaScriptInWeb not run as except.
    thanks.
     
  3. bizabledeveloper

    bizabledeveloper

    Joined:
    Mar 9, 2018
    Posts:
    1
    There are error in unity3d 2018.2.0b3 and received below message

    com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Lcom/onevcat/uniwebview/BuildConfig;

    But it can build it in unity3d 2017
     
  4. RFLG

    RFLG

    Joined:
    Feb 7, 2011
    Posts:
    153
    I'm having this issue as well. Can someone explain how can I get the token using the plugin.

    Also, changing the url and so forth is not possible atm, I need to get the response from the page "as is".

    Can anyone help?
     
  5. onevcat

    onevcat

    Joined:
    Jan 4, 2013
    Posts:
    105
    Maybe you could check this: http://docs.uniwebview.com/api/#setbackbuttonenabled
     
  6. Deleted User

    Deleted User

    Guest

    Hi, Im having problems with UniWebView and its Reference Rect Transform - see the image below.
    pic.png
    The problem is that despite both gray panels having the same anchors and size, the downloaded HTML text is weidly offset differently for both of them, even though the are identical panels, any idea what might be wrong?

    Thanks
     
  7. ThoHer

    ThoHer

    Joined:
    Feb 27, 2018
    Posts:
    13
    Hello there!

    Ive a qustion about implementing this plugin into my mobile application. On Android sometimes appears an blue overlay ontop of the web content, for excample when i choose a category in the header bar of the website. Its like you mark a bunch of content. Is there a possability to avoid that? This problem doesnt exist on IOS devices, only on andorid.

    Ive included an excample image (excample.png).

    It would be great if someone could help me out with this.

    Thank you very much!
     

    Attached Files:

  8. drmop

    drmop

    Joined:
    Aug 26, 2014
    Posts:
    21
    Has anyone managed to get audio files loading with XMLHttpRequest on iOS? They do not load at all for me. Works fine on Android, just not iOS. I always end up with null data returned as response. This is local files located in Assets/StreamingAssets, if I load files from a web server then the audio files load.
     
    Last edited: Nov 25, 2018
  9. Krstn

    Krstn

    Joined:
    Dec 30, 2012
    Posts:
    27
    Is there any way to disable the context menu on android? It's really annoying that a user can long press on an image and a system popup will be displayed.
     
  10. agilelensalex

    agilelensalex

    Joined:
    Apr 7, 2014
    Posts:
    24
    Is it possible for Unity and a local html or xml file to talk to each other? Like can I call a Unity c#/js function from my local file, or vice versa?
     
  11. ThoHer

    ThoHer

    Joined:
    Feb 27, 2018
    Posts:
    13
    Hey There!

    Is it possible to set an ui element above the webView? I would have to show the full content of the website, without a bar or offset to the top boarder, so i would like to show a "close button" straight above the webview in the top right corner.

    Any suggestions would be great!

    Thank you very much!
     
  12. RiccardoAxed

    RiccardoAxed

    Joined:
    Aug 29, 2017
    Posts:
    119
    Hi,

    I've been using UniWebView for some time and it works very well, but now I've a problem opening a chat page that UniWebView fails to do. I know for sure that the page can be opened in a webview using the following methods and settings:

    setUserAgentString("my app string");
    setLoadsImagesAutomatically(true);
    setJavaScriptEnabled(true);
    setDomStorageEnabled(true);
    setAppCacheEnabled(true);

    So, is it possibile to set those properties with UniWebView too?

    I know that at least UniWebView has the SetUserAgent and SetJavaScriptEnabled methods, but the most importants seem to be the last two (that is setDomStorageEnabled and setAppCacheEnabled) for which I couldn't find any infos or documentation. How can I solve that?

    Any other suggestions would be very, very appreciated,

    Thanks!

    Riccardo
     
  13. onevcat

    onevcat

    Joined:
    Jan 4, 2013
    Posts:
    105
    setDomStorageEnabled is already set to true now in UniWebView. I guess the problem is setAppCacheEnabled, which prevents your page to use the app cache. I will try to add support for it too and send you a beta version when it is prepared. Instead of keeping posting here, can you instead open a ticket in our support site through https://docs.uniwebview.com/guide/ticket.html so we can track it better. Thanks!
     
    RiccardoAxed likes this.
  14. saylas_unity

    saylas_unity

    Joined:
    Apr 25, 2019
    Posts:
    3
  15. wiz-japan

    wiz-japan

    Joined:
    May 29, 2014
    Posts:
    12
    Hello,
    I am using UniWebView version 3.7.1.
    Unity version is 2017.4.29f1.
    I have a question,
    ・ Can PDF drawing on Android devices using UniWebView?
    When I try to draw a PDF using an Android device, Intent appears.
     

    Attached Files:

  16. srikanth_vallepu

    srikanth_vallepu

    Joined:
    Mar 19, 2014
    Posts:
    4
    Hi i am srikanth. we are using UniWebView plugin in our projects for payment related things,It is very nice, we struck at one place that when my web page loaded with payment URl and once the process is completed either success/failure i want to get the call back from webpage so that i can destroy webpage and need to show my custom popups ,In the unity Editor it is working fine i am able to get "OnPageFinished" call back but when i make a build and run in android device i am not getting any callbacks.please help me where i missed the code.i have to submit this build very soon to my client.Expecting response.
     
  17. hacanalic

    hacanalic

    Joined:
    Jul 7, 2018
    Posts:
    7
    @onevcat I am using UniWebViewSafeBrowsing to open my auth webpage which have both Facebook and Google Auth implemented in it. I have also implemented DeepLinking to get token in Application.deepLinkActivated callback. I works on both Android and iOS but when url-redirection happen Android custom tab close itself but SFSafariViewController DID NOT.

    Is there any way to make it work same as android? like closing itself after redirection to url to which I have registered scheme?
     
  18. prasetion

    prasetion

    Joined:
    Apr 3, 2014
    Posts:
    28
    I know, this is old post. i get the same issue in here, i want to send string parameter into my html javascript, but is not working, wondering the solution for this issue
     
  19. onevcat

    onevcat

    Joined:
    Jan 4, 2013
    Posts:
    105
    It is usually due to you are not correctly "double quote" your parameter. Like this:

    var parameter = "hello";

    Instead of

    webView.EvaluatingJavaScript("say(" + parameter + ");");

    You need:

    webView.EvaluatingJavaScript("say(\"" + parameter + "\");");

    to make it work.

    The previous result is
    say(hello);
    , which is not a valid JS call, while the latter is
    say("hello");
    , a perfect one.
     
  20. prasetion

    prasetion

    Joined:
    Apr 3, 2014
    Posts:
    28
    it work's, thank you. Maybe you should add this into your documentation :)
     
  21. vasanthbalaji

    vasanthbalaji

    Joined:
    Nov 15, 2014
    Posts:
    34
    @onevcat

    Download and print option is not working in Uniwebview android, In Chrome browser the download option opens in new tab and downloads in device , the same is also print. How to do this in Uniwebview android
     
  22. dbillings

    dbillings

    Joined:
    Mar 3, 2020
    Posts:
    6
    @onevcat hello, when opening a local pdf using Uniwebview on iOS it achieves the desired effect of rendering it in place, however in Android it wants to download it, and then it crashes when clicking yes and doesnt render the pdf when choosing no. Is there a way to have Android render out the pdf file in uniwebview from a local file location?
     
  23. onevcat

    onevcat

    Joined:
    Jan 4, 2013
    Posts:
    105
    Hi, @dbillings

    On iOS, the WKWebView supports rendering a PDF in place, so it can be displayed without any effort. However, on Android it is not the case. You may need to host the PDF file somewhere and load it through some JavaScript. I suggest you can check the PDF.js project or put your file to some PDF readers like Google Docs to display it.

    And it is strange that the downloading crashes. By default, if the file cannot be displayed, UniWebView will try to download it to the app folder. Can you try to add some permission such as write external to see if the crash can be fixed (or providing us some logs or more information so we can check what's going on). If you can download the file, you can also get a local disk URL pointing to the file and choose to ask users to open it with another app (a PDF reader or so) on the device.

    For more about file downloading, you can check this guide: https://docs.uniwebview.com/guide/download-files.html
     
  24. AbbasAhsan

    AbbasAhsan

    Joined:
    Nov 16, 2020
    Posts:
    2
    I am facing a very strange and weird issue with UniWebView. The text content is over scanning horizontally on the iPhone and it is not fitting within the width. It is frustrating because it is working completely fine on Android (phones and tab both) and even on iPads. I am attaching the screenshots of horizontally over scanning on iPhones.

    Looking forward to any help as this issue has consumed so much time. Thanks.


    Skype_Picture_2021_04_27T12_25_19_942Z.jpeg
     
  25. onevcat

    onevcat

    Joined:
    Jan 4, 2013
    Posts:
    105
    Hi,

    On iOS, the system web view will respect the CSS and page layout better, so you can choose either to solve it:

    1. Update your site and make it follow the responsive web design. Basically, you can ask your frontend developer to add this line to the page's head:

    ```xml
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    ```

    2. Or, call [`SetZoomEnabled(true)`](https://docs.uniwebview.com/api/#setzoomenabled) before you load and show the page. This will tell iOS that it can zoom the page to fit the size. However, it is not an ideal solution in some cases, since it enables your user to zoom the page by a pinch gesture.

    Best regards.
     
    AbbasAhsan likes this.
  26. andyz

    andyz

    Joined:
    Jan 5, 2010
    Posts:
    2,251
    Hi looking at your plugin (not got) I see mention of Unity overhead when using the webview. I need low/zero overhead from Unity while a fullscreen webview is open - will the Safe Browsing Mode achieve this or there is always an overhead from Unity? Does the webview run in a separate activity on android?
     
  27. onevcat

    onevcat

    Joined:
    Jan 4, 2013
    Posts:
    105
    > Does the webview run in a separate activity on android?

    If running under the Safe Browsing Mode, UniWebView does run in a separate activity on Android. And yes, it does not add an overhead to Unity since your Unity game would become inactive in this state. You cannot interact with your Unity games or see its content when using the Safe Browsing Mode.
     
    andyz likes this.
  28. dbillings

    dbillings

    Joined:
    Mar 3, 2020
    Posts:
    6
    Hi @onevcat here is the error that happens when the app crashes on android when trying to download the PDF when using
    url = UniWebViewHelper.StreamingAssetURLForPath("dummy.pdf");
    to try to open a PDF file in streaming assets. the same code works fine for internal png and html files but breaks when trying to open the pdf


    Code (CSharp):
    1. 2021-04-29 15:52:46.899 24995-24995/? E/AndroidRuntime: FATAL EXCEPTION: main
    2.     Process: com.DefaultCompany.TextronWallAppUnity, PID: 24995
    3.     java.lang.IllegalArgumentException: Can only download HTTP/HTTPS URIs: file:///android_asset/dummy.pdf
    4.         at android.app.DownloadManager$Request.<init>(DownloadManager.java:634)
    5.         at com.onevcat.uniwebview.UniWebViewFileDownloader.downloadWithManager(UniWebViewFileDownloader.kt:116)
    6.         at com.onevcat.uniwebview.UniWebViewFileDownloader.access$downloadWithManager(UniWebViewFileDownloader.kt:18)
    7.         at com.onevcat.uniwebview.UniWebViewFileDownloader$showDownloadDialog$1.onClick(UniWebViewFileDownloader.kt:105)
    8.         at com.android.internal.app.AlertController$ButtonHandler.handleMessage(AlertController.java:188)
    9.         at android.os.Handler.dispatchMessage(Handler.java:106)
    10.         at android.os.Looper.loop(Looper.java:246)
    11.         at android.app.ActivityThread.main(ActivityThread.java:8506)
    12.         at java.lang.reflect.Method.invoke(Native Method)
    13.         at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:596)
    14.         at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
     
  29. AbbasAhsan

    AbbasAhsan

    Joined:
    Nov 16, 2020
    Posts:
    2
    Thankyou for your input. Yes I tried setZoomEnabled(true) after posting this question and it worked in my case and is meeting my requirement so I am going with that solution. Thanks.
     
  30. onevcat

    onevcat

    Joined:
    Jan 4, 2013
    Posts:
    105
    Ah...I see. It seems that the Android downloader are not going well with a file URL. We will try to see if we can find a way to "download" a file from a file URL like that soon.

    However, as I mentioned in the previous reply, it is still not possible to display a PDF in the Android WebView.
     
  31. snahtajain

    snahtajain

    Joined:
    Mar 5, 2021
    Posts:
    1
    Hi,

    I am also having the same issue while creating a website using UI UX design tool. Now I have gotten resolved. Thnaks
     
  32. zerotouch

    zerotouch

    Joined:
    Jan 21, 2018
    Posts:
    1
    Hi!

    i have a few quick questions:
    background:
    - i want to display a in-code generated html with UniWebView. Mostly works nicely until i try to display local images (from my unity-resources)
    - the images are in my "Resources" folder (and used elsewhere in the project also)

    Q1: can i display images from "Resources"? this would be the best if i could
    Q2: do i need to move all my assets into the "StreamingAssets" folder and access from there? if so, can "StreamingAssets" folder be under "Resources" folder? like this: "Resources/StreamingAssets"? If so please confirm that i can use them as unity resource for unity components AND also streamable assets for UniWebView in the same time?

    thanks!

    daniel
     
    Last edited: Mar 31, 2022
  33. BigGameCompany

    BigGameCompany

    Joined:
    Sep 29, 2016
    Posts:
    109
  34. Vandallord

    Vandallord

    Joined:
    Jan 3, 2017
    Posts:
    2
    when will you make support work inside unity on windows?
     
    kikchitov likes this.
  35. maruccisolutions

    maruccisolutions

    Joined:
    Feb 22, 2023
    Posts:
    4
    Hi,
    I'm doing Google and Facebook authentication through an API, and the only thing I would need was the return of the value in JSON.
    And for me to access this page, the only way it allows me is through SafeBrowsing, and I am not able to get this JSON.
    Could you tell me if there is any way to use the normal WebView in this? Or only with SafeBrowsing? If it's only with SafeBrowsing, would you be able to get this value?
     
  36. onevcat

    onevcat

    Joined:
    Jan 4, 2013
    Posts:
    105
    Hi,

    In UniWebView version 5, we added the OAuth 2.0 support and now this package can perform the standard OAuth login. Please check the related guide for more: https://docs.uniwebview.com/guide/oauth2.html
     
  37. maruccisolutions

    maruccisolutions

    Joined:
    Feb 22, 2023
    Posts:
    4
    Hi,
    Thanks for the information.
    I trying to implement with GoogleFlowAuth, and gives me an error:
    Unity Exception: called non-existent method System.Collections.Specialized.NameValueCollection System.Web.HttpUtility::parseQueryString(System.String) in UniWebViewAuthenticationFlow.cs:208

    For I search, this is a fault of info about System.Web in link.xml because I building in IL2CPP, but for me its not working.
    Any ideas?
     
  38. onevcat

    onevcat

    Joined:
    Jan 4, 2013
    Posts:
    105
    Ummm, this is the first time I receive this kind of report.

    I've tried to use IL2CPP and cannot reproduce this issue. So I guess it might be more likely related to your environment. I would suggest first checking if the content of "UniWebView/csc.rsp" is correct as "-r:System.Web.dll", which asks the Unity build system to keep the symbols. Also, please make sure you have selected ".Net Standard 2.1" as your Api Compatibility Level.

    Finally, if all these cannot solve the issue, maybe try to upgrade the Unity version to the latest.
     
  39. maruccisolutions

    maruccisolutions

    Joined:
    Feb 22, 2023
    Posts:
    4
    Hi, I only have .NET 4.x and .NET Standard 2.0
    upload_2023-2-24_0-31-47.png
    I'm using Unity 2020.3.36f1
     
  40. maruccisolutions

    maruccisolutions

    Joined:
    Feb 22, 2023
    Posts:
    4
    I think .NET Standard 2.0 works.
    But there's a way to make works with .NET 4.x?
     
  41. onevcat

    onevcat

    Joined:
    Jan 4, 2013
    Posts:
    105
    So maybe that is the reason.

    Then I would suggest you find a chance to perform an upgrade of Unity. It seems that .NET Standard 2.1 was added from Unity 2021.2.
     
    maruccisolutions likes this.
  42. ubugames

    ubugames

    Joined:
    Sep 5, 2021
    Posts:
    2
    Hey @onevcat,

    I'm receiving this error when I'm trying to use the Google Auth Flow on an iOS device. Is worth noting that this problem doesn't appear on the Android device, only on the iOS.
    <UniWebView> Exception on exchange token response: System.NullReferenceException: Object reference not set to an instance of an object
    at UniWebViewAuthenticationFlowGoogle.GetAccessTokenRequestParameters (System.String authResponse) [0x0004e] in C:/PROJECT_PATH/Assets\UniWebView\Script\UniWebViewAuthentication\UniWebViewAuthenticationFlowGoogle.cs:147
    at UniWebViewAuthenticationFlow`1[TTokenType].ExchangeToken (System.String response) [0x00002] in C:/PROJECT_PATH/Assets\UniWebView\Script\UniWebViewAuthentication\UniWebViewAuthenticationFlow.cs:171 . Code: -1. Message: Object reference not set to an instance of an object
    UnityEngine.StackTraceUtility:ExtractStackTrace () (at /Users/bokken/build/output/unity/unity/Runtime/Export/Scripting/StackTrace.cs:37)
    UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
    UnityEngine.Logger:Log (UnityEngine.LogType,object)
    UnityEngine.Debug:LogError (object)
    UniWebViewLogger:Log (UniWebViewLogger/Level,string) (at C:/PROJECT_PATH/Assets/UniWebView/Script/UniWebViewLogger.cs:115)
    UniWebViewLogger:Critical (string) (at C:/PROJECT_PATH/Assets/UniWebView/Script/UniWebViewLogger.cs:108)
    UniWebViewAuthenticationFlow`1<UniWebViewAuthenticationGoogleToken>:ExchangeToken (string) (at C:/PROJECT_PATH/Assets/UniWebView/Script/UniWebViewAuthentication/UniWebViewAuthenticationFlow.cs:181)
    UniWebViewAuthenticationFlow`1<UniWebViewAuthenticationGoogleToken>:<StartAuth>b__2_0 (UniWebViewAuthenticationSession,string) (at C:/PROJECT_PATH/Assets/UniWebView/Script/UniWebViewAuthentication/UniWebViewAuthenticationFlow.cs:158)
    UniWebViewAuthenticationSession:InternalAuthenticationFinished (string) (at C:/PROJECT_PATH/Assets/UniWebView/Script/UniWebViewAuthentication/UniWebViewAuthenticationSession.cs:90)
    UniWebViewNativeListener:AuthFinished (string) (at C:/PROJECT_PATH/Assets/UniWebView/Script/UniWebViewNativeListener.cs:180)
    System.Reflection.RuntimeMethodInfo:Invoke (object,System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo)
    System.Reflection.MethodBase:Invoke (object,object[])
    UniWebViewInterface:SendMessage (intptr,intptr,intptr) (at C:/PROJECT_PATH/Assets/UniWebView/Interface/UniWebViewCocoa.cs:75)
    My implementation of the Auth Flow can be found here:
    Code (CSharp):
    1. /// <summary>
    2.     /// Opens a webpage that prompts the user to sign in and copy the auth code
    3.     /// </summary>
    4.     public static void GetAuthCode()
    5.     {
    6.         if (UniWebViewAuthenticationSession.IsAuthenticationSupported)
    7.         {
    8.             UniWebViewAuthenticationFlowGoogle googleFlow = new()
    9.             {
    10.                 clientId = GetClientId(),
    11.                 redirectUri = GetRedirectUri(),
    12.                 scope = "email",
    13.             };
    14.             googleFlow.StartAuthenticationFlow();
    15.         }
    16.         else
    17.         {
    18.             Application.OpenURL($"https://accounts.google.com/o/oauth2/v2/auth?client_id={GetClientId()}&redirect_uri={GetRedirectUri()}&response_type=code&scope=email");
    19.         }
    20.     }
    21.     /// <summary>
    22.     /// Exchanges the Auth Code with the user's Id Token
    23.     /// </summary>
    24.     /// <param name="code"> Auth Code </param>
    25.     /// <param name="callback"> What to do after this is successfully executed </param>
    26.     public static async Task<GoogleIdTokenResponse> ExchangeAuthCodeWithIdToken(string code, Func<string, string, Task> callback)
    27.     {
    28.         // ServicePointManager
    29.         //         .ServerCertificateValidationCallback +=
    30.         //     (sender, cert, chain, sslPolicyErrors) => true;
    31.         var request =
    32.             (HttpWebRequest)WebRequest.Create(
    33.                 $"https://oauth2.googleapis.com/token?code={code}&client_id={GetClientId()}&redirect_uri={GetRedirectUri()}&grant_type=authorization_code");
    34.         request.Method = "POST";
    35.         request.ContentLength = 0;
    36.         request.Expect = "application/json";
    37.         var response = (HttpWebResponse)await request.GetResponseAsync();
    38.         string responseString;
    39.         using (var responseStream = response.GetResponseStream())
    40.         {
    41.             if (responseStream == null)
    42.             {
    43.                 throw new GoogleIdTokenException(
    44.                     "An error occurred while trying to request Google ID Token from server: Response stream is empty");
    45.             }
    46.             using (var reader = new StreamReader(responseStream, Encoding.UTF8))
    47.             {
    48.                 responseString = await reader.ReadToEndAsync();
    49.             }
    50.         }
    51.         if (response.StatusCode == HttpStatusCode.OK)
    52.         {
    53.             var data = JsonUtility.FromJson<GoogleIdTokenResponse>(responseString);
    54.             // Debug.Log("ID TOKEN: " + data.id_token);
    55.             // Debug.Log("ACCESS TOKEN: " + data.id_token);
    56.             return data;
    57.             await callback(data.id_token, data.access_token);
    58.         }
    59.         Debug.LogError(responseString);
    60.         throw new GoogleIdTokenException(
    61.             $"An error occurred while trying to request Google ID Token from server: {responseString}");
    62.     }
    63.     private static string GetClientId()
    64.     {
    65.         return Application.platform == RuntimePlatform.Android ? ClientIdAndroid : ClientIdIOS;
    66.     }
    67.     private static string GetRedirectUri()
    68.     {
    69.         return Application.platform == RuntimePlatform.Android ? RedirectUriAndroid : RedirectUriIOS;
    70.     }
    Please let me know what should I try differently.
    Thanks!
     
  43. ubugames

    ubugames

    Joined:
    Sep 5, 2021
    Posts:
    2
    Not using the OnAuthenticationFinished event causing my issue. Trying the WebView on the Android made me thing that it was working as deeplink.

    Anyways, solved :)
     
  44. Raptcha911

    Raptcha911

    Joined:
    Sep 19, 2014
    Posts:
    24
    @onevcat I'm trying to use Uniwebview's OAuth flow combined with the Uniwebview messaging system. How do I get access to the uniwebview instance that opens the SSO page so that I can subscribe to the Uniwebview messages I send from my webpage after a sucessful login?
    The webview variable in the listener is always null when doing OAuth stuff.
     
    Last edited: Jul 6, 2023
  45. Raptcha911

    Raptcha911

    Joined:
    Sep 19, 2014
    Posts:
    24
    Anybody?
     
  46. Raptcha911

    Raptcha911

    Joined:
    Sep 19, 2014
    Posts:
    24
  47. Raptcha911

    Raptcha911

    Joined:
    Sep 19, 2014
    Posts:
    24
  48. chanka

    chanka

    Joined:
    Nov 9, 2021
    Posts:
    1
    Hi @onevcat,

    First of all congratulations for the easy to use API, really fast to get a web view playing video!
    But we are having a big issue with unity audio not playing after playing html5 video
    we have mute other audio sources enabled, when disabled works fine.
    After some debugging what I can see is when I create a uniwebview and load an url unity is not triggering the application focus event. And If I force a application focus event, simple home out and back to the game audio is back to normal

    Thanks!
     
  49. AZRetro

    AZRetro

    Joined:
    Aug 29, 2017
    Posts:
    4
    So we're trying to get the displayed webpage to pinch-zoom. I did a SetZoomEnabled on android and the page does not zoom or pinch zoom. Am I using that function wrong?

    Code:
    Code (CSharp):
    1. private void Start()
    2.     {
    3.         webview.Show();
    4.         webview.SetZoomEnabled(true);
    5.     }
     
  50. onevcat

    onevcat

    Joined:
    Jan 4, 2013
    Posts:
    105
    This code should enable the web view level zoom support. However, it is only half of the story. If the zoom is not yet working even you called this, I would suggest to check if your page contains a meta tag like "user-scalable" and it is set to no. With that meta tag, the zooming can also be disabled and there is no way for UniWebView to enable the zoom only by itself. For more, maybe check this: https://sitebulb.com/hints/mobile-friendly/the-viewport-meta-tag-prevents-the-user-from-scaling/