GithubHelp home page GithubHelp logo

unity-webview's People

Contributors

allan-o3h avatar appirits-nakamatsu avatar astrubel avatar bala-kyawhtin-tecotec avatar chantmk avatar codec-abc avatar dolow avatar drc-genki-kokubun avatar flashwade03 avatar hallucinogen avatar hanachiru avatar hiroyuki0115 avatar imkira avatar jake1256 avatar jaredhays avatar jlabarca avatar kojinakamaru avatar n-yoda avatar okayasu avatar philipp-m avatar rskorski-gsn avatar sergei-a-mindojo avatar shika-n avatar shinobushiva avatar shinriyo avatar splhack avatar sumidatx avatar takeh1k0 avatar takumikimura avatar trapezoid avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

unity-webview's Issues

iOS error

Hello,

The Sample project on iOS works fine, but when I add it in my working project, it gives an error. I have other plugins like Facebook, Appsflyer, GA. Anything to do because of this?

Please help.

Thanks

Undefined symbols for architecture arm64:
"__WebViewPluginMakeTransparentBackground", referenced from:
_WebMediator__WebViewPluginMakeTransparentBackground_m545 in Bulk_Assembly-CSharp-firstpass_0.o
_WebMediator_MakeTransparentWebViewBackground_m550 in Bulk_Assembly-CSharp-firstpass_0.o
(maybe you meant: _WebMediator__WebViewPluginMakeTransparentBackground_m545)
"__WebViewPluginSetMargins", referenced from:
_WebMediator_ApplyMarginsPlatform_m547 in Bulk_Assembly-CSharp-firstpass_0.o
_WebMediator__WebViewPluginSetMargins_m543 in Bulk_Assembly-CSharp-firstpass_0.o
(maybe you meant: _WebMediator__WebViewPluginSetMargins_m543)
"__WebViewPluginLoadUrl", referenced from:
_WebMediator__WebViewPluginLoadUrl_m541 in Bulk_Assembly-CSharp-firstpass_0.o
(maybe you meant: _WebMediator__WebViewPluginLoadUrl_m541)
"__WebViewPluginInstall", referenced from:
_WebMediator_Install_m532 in Bulk_Assembly-CSharp-firstpass_0.o
_WebMediator_InstallPlatform_m546 in Bulk_Assembly-CSharp-firstpass_0.o
_WebMediator__WebViewPluginInstall_m540 in Bulk_Assembly-CSharp-firstpass_0.o
(maybe you meant: _WebMediator__WebViewPluginInstall_m540)
"__WebViewPluginSetVisibility", referenced from:
_WebMediator_UpdatePlatform_m548 in Bulk_Assembly-CSharp-firstpass_0.o
_WebMediator__WebViewPluginSetVisibility_m542 in Bulk_Assembly-CSharp-firstpass_0.o
(maybe you meant: _WebMediator__WebViewPluginSetVisibility_m542)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Crash on calling WebViewObject.SetVisibility(false) on Editor mode

Hello,

Unity Editor crashes when WebViewObject.SetVisibility(false) is called.

I put a button and call Unity.call('close') in the html then make the webview to be closed when it received 'close' message.

The message is correctly arrived on Unity but it crashes when it calls WebViewObject.SetVisibility(false).:

    // regisiter callback
    webViewObject.Init((msg)=>{
        Debug.Log(string.Format("CallFromJS[{0}]", msg));

        if (msg == "close")
        {
            webViewObject.SetVisibility(false);
        }
    });

The only differences what I've changed is putting code which check the message then change the visibility of the webviewObject.

I ran it on OSX 10.8.2.

I also tried to do clean build the OSX plugin with Xcode 4.6. Building 32bit bundle has no problem, but got bunch of errors with 64bit bundle.

Is there any way to debug OSX bundle when Unity is on play mode?

-Kim

Plugin is not working on xcode 6

Because xcode 6 using ARC and new API, this plugin occurred a lot of bug!
WebViewPlugin *webViewPlugin = (WebViewPlugin *)CFBridgingRelease(instance);
[webViewPlugin loadURL:url];
not working and force stopped!

Unable to reload live url

Look #51 is the same but the reporter had been resolved the issue, but I can not resolve this in my case. So I repost a new issue here.

In sample project, I just want to change the Url in the Inspector like "www.unity3d.com", but I can not open the web page in my webview component, but get an exception

IsolatedStorageException: Could not find a part of the path "/storage/emulated/0/Android/data/net.gree.webview.sample/files/http:/unity3d.com/".

I tried to remove the following that I webviewObject.loadUrl(url) to load the specify url directly. But get the issue I posted in #71

var src = System.IO.Path.Combine(Application.streamingAssetsPath, Url);
var dst = System.IO.Path.Combine(Application.persistentDataPath, Url);
var result = "";
if (src.Contains("://")) {
var www = new WWW(src);
yield return www;
result = www.text;
} else {
result = System.IO.File.ReadAllText(src);
}
System.IO.File.WriteAllText(dst, result);

callback is not returned when you run the actual machine of iOS

I am not sorry to ask questions in a row

It did not come in place of a call back when you run in iphone actual equipment.

Normally callback was returned in on Unity editor.

We tried to determine the cause

WebView.mm of

gameObjectName = [NSString stringWithUTF8String: gameObjectName_];

It was like a cause in which the object name is not set correctly at the.

If you change as described below, we were able to get the correct object name.

// gameObjectName = [NSString stringWithUTF8String: gameObjectName_];
    
     gameObjectName = [[NSString alloc] initWithUTF8String: gameObjectName_];

You think I can get successfully object name in those of the author like?

***** Enviroment *****
iOS8.4
iPhone5S
Xcode6.4

erase touch

Hello,
on android the touch erased does not work, would it be possible to fix this bug?

Thank you

local webpage

Is it possible to show a local webpage in unity-webview? I took the sample project and copied my webpage to Assets/StreamingAssets/www
then I changed SampleWebView.cs, invoking the webpage with

    string s = "jar:file://" + Application.dataPath + "!/assets/www/index.html";
    webViewObject.LoadURL(s);

in Start() - it is an example for Android.
The result is "Website not available". Am I missing something?

XCode cannot validate archive while preparing to upload to app store.

Your plugin is working fine on both android and ios. It's run smoothly on my iPad mini 1. However, when I tried to archive it, it showed me this:

Archieve validatation failed due to the issues listed below.
Unable to validate your application.
The archive is invalid. /var/folders/hh/lq2dx5x57r5csdfb25sx25dr0000gn/T/XcodeDistPipeline.q24/Packages/Unity-iPhone.ipa does not exist.

I searched and found some workaround, which is go to Build Phases -> Copy Bundle Resources -> remove Webview.bundle and it's fixed. However, not not sure if it will effect the final app when it has been downloaded from store or not since it has been removed. Anybody know about this issue?

DllNotFoundException: WebView WebViewObject.Init

I import the project in unity Version 4.5.2f1.
and then I upgrade this project
1

and then i have problem when compile the project and shows the error like this 👍
DllNotFoundException: WebView
WebViewObject.Init (System.Action`1 cb) (at Assets/Plugins/WebViewObject.cs:119)
SampleWebView.Start () (at Assets/Scripts/SampleWebView.cs:34)

what should i do? thank you for your attention and i hope you will be pleasure to answer me. :-)

MAC Editor webview is not loaded non-secure http or self signed https

Hi,

I am trying to do some tests inside my MAC Unity Editor, but I noticed that only https urls are loaded, otherwise, they are not loaded.
So I created a self signed certificate on my LAN server, I added the certificate to MAC System Keychain and set it to trusted, but even after that I cannot get the HTTPS url to be loaded inside the MAC Editor webview.

The urls are correctly loaded only when it is HTTPS with a certificate from a trusted certificate authority.

Any hep is greatly appreciated.

mac app store validation pre 10.8

Webview doesn't work on signed app with mac app store validation enabled on OS prior 10.8. Just blank view.
Both 10.6 and 10.7 affected.
Without store validation everything is ok.

Web page not displaying in Unity 5 on MacOS (v5.0.2f1)

I rebuilt the WebView.bundle using universal 32-64bit architecture (http://docs.unity3d.com/Manual/PluginsForDesktop.html) to eliminate the "mach-o" errors on MacOS Unity 5 but web pages do not display at all when specifying a URL (local or otherwise).

I get no errors and just a blank texture.

I also tried building WebView.bundle with the other 64 bit architectures but I get the same results. No web page being displayed in both the sample scene and my project.

The sample scene and my project work fine in Unity 4.6 but I need to upgrade to Unity 5. (-.- ;)

If anyone has any suggestions or workarounds please advise.

[Unity5]Couldn't open Assets/Plugins/WebView.bundle/Contents/MacOS/WebView, error

I tried using ‘unity-webview’ on editor of Unity5, but the following error occured -
"Couldn't open Assets/Plugins/WebView.bundle/Contents/MacOS/WebView, error: dlopen(Assets/Plugins/WebView.bundle/Contents/MacOS/WebView, 2): no suitable image found. Did find:
Assets/Plugins/WebView.bundle/Contents/MacOS/WebView: mach-o, but wrong architecture".

Does anyone know how to solve this problem?

My computer's info...
OS:Mac OS X(Yosemite)
Processor: Core i7(64bit)

I can use 'unity-webview' on Unity4.x.

How to get URL ?

string Url;
WebViewObject webViewObject;

string mUrl;

void Start()
{

    Url = "https://graph.facebook.com/oauth/authorize?client_id=296194087105506&redirect_uri=http://www.facebook.com/connect/login_success.html&scope=publish_actions&type=user_agent&display=popup";
    webViewObject = (new GameObject("WebViewObject")).AddComponent<WebViewObject>();
    webViewObject.Init((msg) =>
    {
        if (msg.StartsWith("http"))
        {
            mUrl = msg.Substring(4);
        }
        if (msg.StartsWith("url:"))
        {
            mUrl = msg.Substring(4);
        }

    });
    webViewObject.EvaluateJS(@"
        window.addEventListener('onpageshow', function(){
        Unity.call('url:' + window.location.href);
         }, false);
    ");

    webViewObject.EvaluateJS("if (location) window.Unity.call(location.href);");

    webViewObject.SetMargins(5, 200, 5, 500);
    webViewObject.SetVisibility(true);
    webViewObject.LoadURL(Url);
}

void OnGUI()
{

    GUI.Box(new Rect(0, 0, 300, 25), mUrl);
}

And I tried this code :#8

Not return the current url. :/

Keyboard issue

I started the sample project (with Google url) and i couldnt write letters in the google textbox).

Unity 3.5.7
Tested on HTC Desire and Nexus 7 (both with Android 4.2.1).

Black background for android:targetSdkVersion > 14

In our application, we only show the web view inside a header and footer, but after finished loading website, the footer is cover by a black color cover. Header also is cover by a black cover but only a part as in the attached image.

We discovered that if we set android:targetSdkVersion is less than or equal to 13, this issue does not occur. But API level 13 is too old now.

Please give me any suggestion to fix this problem.
Thank you.

blackbackground

Can't send consecutive javascript commands to unity using src method

I can't seem to send multiple consecutive javascript commands to unity using the current scheme which is to send it in a url.

    document.getElementById("Unity").src="unity:foo()";

Is there a way to use SendMessage from javascript, or another way to use the current implementation to send two consecutive javascript commands and have them both go through to unity?

Vimeo Video Issue - Android

Hi,

I am trying to get a Vimeo video to play on Android, but its not working. I am calling LoadUrl with the Vimeo link, but when I press the play button on the page nothing happens? Any suggestions?

Adam

Playing youtube videos does not work

Hi,

When I enter a youtube url, I get the thumbnail and play button rendered correctly on both MAC unity editor and Android, but when I press play, it just spins indefinitely.
Android additionally displays an error message "If playback doesn't begin shortly, try restarting your device."

Thanks.

How to close the webview?

First, thanks for your kind to make it open source and share with us, It's really cool!

From your code, there's no function provided to close the webview, only to hide it,
If I want to close it at runtime, what should I do?
Thanks in advance;

Acces to the internal canvas

I'm trying to draw the webview on a 3d object, and i managed to get this working fine in the Unity Editor (including mouse position etc.)
However, this doesnt seem possible on IOS or Android.

Webview Background Color

Is there a way to change the background color of the gree/unity-webview? How can I change the color of the webview on Unity3D?

WebView Error

Hi, i had this issues when I click to play button in unity editor, I use unity 4.3 and I don't know how to fix this error. Web browser doesnt work and nothing works after start scene... Help please.

DllNotFoundException: WebView
WebViewObject.Init (System.Action`1 cb) (at Assets/plugins/WebViewObject.cs:139)
SampleWebView.Start () (at Assets/Scripts/SampleWebView.cs:34)

How to play video?

I try autoplay or embed mp4 format videos, I do press to play button but not play. ( I try it on local and web page)

Blank on Facebook Feed Dialog

Hello, I've been trying to use this to implement Facebook to a mobile app. Authorizing the user through the Auth dialog worked just fine - but I keep getting a blank screen when I try to display the Feed dialog. The same URL generated and dropped into a browser does seem to work. I am going to continue looking to see if it is a Facebook security issue of some sort, but was curious if possibly the page was just not being rendered correctly - what are some of the limitations of the web view if any?

Feed Dialog URL is generated as: http://m.facebook.com/dialog/feed?access_token={Access Token}&app_id={App ID}&from={Authroized User}&to={Selected Friend ID}&link={Post Link}&name={Post Name}& description={Post Description}&redirect_uri={My Redirect Page.aspx}

Thanks in advance for any assistance

Can't go back page?

This is very good and easy plugin!!

but, I can't find go back page method..

how can I go back page?

UnitySendMessage() failing on Mac in Unity 4.2.2f1?

I integrated this plugin into my Unity project a while back with a few minor modifications. I had it disabled for a while and now I'm trying to use it again.

During that time I upgraded to Unity 4.2.2f1. It seems that, due to that upgrade (?), this line in "webView:decidePolicyForNavigationAction:request:frame:decisionListener:" consistently causes a crash (with no callstack, sadly) when running in editor on the Mac:

UnitySendMessage([gameObject UTF8String],
"CallFromJS", [[url substringFromIndex:6] UTF8String]);

I can't determine exactly what's wrong, but the crash seems to occur on the line where UnitySendMessage() calls mono_runtime_invoke().

Last time I checked, the iOS version of the plugin worked fine. I'm unfamiliar with Mac plugins so I'm feeling around in the dark here; any insight would be appreciated!

WebView issue in Android

Hi,

I was not able to open an url using the plugiin n Android. I used the 'sample' project that was available with the source. I imported the 'unity-webview' package available in the 'dist' folder. I added a section to detect if the runtime is Android and open the url.

The url was set to: http://www.google.com

Thanks,
BP

How is it possible OnWebBrowserNewWindow event handling?

void OnWebBrowserNewWindow(string URL, int Flags, string TargetFrameName, ref object PostData, string Headers, ref bool Processed)
{
Processed = true;
//WBrowser.Navigate(URL);
}

I do not want to ensure the opening of a new window. Is it possible?

iOS XCode project throwing compiler errors

I have a simple scene that adds a web view to the screen. Exporting the project to XCode and trying to run throws compiler errors. It looks like the WebView.mm isn't compatible with Automatic Reference Counting (ARC) which is turned on in the Xcode Project.

I've found references on being able to turn off ARC for specific files in the XCode project, but I'm wondering if there's a way to make this work without having to change the XCode project every time I build.

I'm using Unity 5 beta v18

Thanks in advance for any help on this.

GetUrl()

Is it possible to have a method getUrl which to return the current url

Thank you

Resolution of Uncaught TypeError: Object [object Object] has no method 'call'

Thank you for great library for Unity 3D. But I found one bug that native code can't catch callback from javascript. This problem appears only over Android 4.2.

So I have found on google. This is hint I found : http://stackoverflow.com/questions/14031635/android-4-2-1-webview-and-javascript-interface-breaks

I changed build target to 4.2.2 and modified code like below. (just @JavascriptInterface added)

class WebViewPluginInterface
{
    private String mGameObject;

    public WebViewPluginInterface(final String gameObject)
    {
        mGameObject = gameObject;
    }

    @JavascriptInterface
    public void call(String message)
    {
        UnityPlayer.UnitySendMessage(mGameObject, "CallFromJS", message);
    }
}

In result, this is work fine after added an annotation.

OSX Unity5.3 doesn't update webview texture

Unity5.3 changes OpenGL version to 3.3. currently, unity-webview OSX doesn't work on default settings.

Workaround: use -force-opengl flag

open -a Unity --args -force-opengl

-- to japanese

Unity5.3はOpenGL3.3を使うようになったのでデフォルトの設定ではWebviewのテクスチャ更新が動作していません。
取り急ぎお困りの方は上記コマンドをTerminalから打ってOpenGL 2.1バックエンドを使うようにすればOSX上のUnityEditorでもWebviewが表示されるようになります。

Is it should be how to get the call back from the Web in Unity side? (Android)

The following page to reference it was implemented callback processing of WebView.
http://loumo.jp/wp/archive/20131115085810/

Where you saw the WebViewPlugin.java, it has the following description

    @JavascriptInterface
    public void call(String message)
    {
        UnityPlayer.UnitySendMessage(mGameObject, "
CallFromJS", message);
    }

To

public void CallFromJS (string message) 

within WebViewObject.cs
I wrote Debug.Log, but the log did not appear.

The following is the source code of Unity side

*************** Unity Side Source Code ***************
using UnityEngine;
public class WebviewSample : MonoBehaviour
{
    private string url = "http://www.google.com/";
    WebViewObject webViewObject;
    void Start() {
        webViewObject =
            (new GameObject("WebViewObject")).AddComponent<WebViewObject>();
        webViewObject.Init((msg)=>{
            Debug.Log("***** clicked *****=" + msg);
            if (msg == "clicked") {
                Debug.Log("***** clicked ok *****");
                webViewObject.SetVisibility(false);
            }
        });
        webViewObject.LoadURL(url);
        webViewObject.SetMargins(50,100,50,50);
        webViewObject.SetVisibility(true);
        webViewObject.EvaluateJS(
            "window.addEventListener('load', function() {" +
            "   window.addEventListener('click', function() {" +
            "       Unity.call('clicked');" +
            "   }, false);" +
            "}, false);");
    }
    void OnGUI() {
        Rect textArea = new Rect(100, 0, 400, 100);
        url = GUI.TextArea(textArea, url);
        if (GUI.Button ( new Rect(500,0,100,100), "GO")) {
            webViewObject.LoadURL(url);
            webViewObject.SetVisibility(true);
        }
    }
}

sample application bug (invalid URL scheme)

webViewObject.LoadURL("files:/" + Application.dataPath + "/WebPlayerTemplates/unity-webview/" + Url);

This line make invalid URL scheme.
So I fixed like following line.

webViewObject.LoadURL("file://" + Application.dataPath + "/WebPlayerTemplates/unity-webview/" + Url);

Landscape Display on IOS

Hello, When using the web view plugin in my landscape game on IOS(android works as expected), the web view does not fill up the screen. It looks like it is keeping the portrait sizing, but displaying vertically in landscape. Do you have any ideas on what I can do to get this to work properly?

Thank you,
Dylan

Windows or WinPhone?

I was just curious if you have tried this on Windows or Windows Phone and it failed. Or if you haven't tried it so thus not listed. Any idea what it would take to work?

To view the Unity screen of the front than WebView?

Currently, using the margin of WebView Displaying Unity of parts and WebView at the same time, please tell me whether the following is possible

If you were to view the WebView,
Always Will it be displayed in the front than the Unity?

Is it possible to be displayed in the front than the WebView the Unity of the button?

Nice to meet you.

DllNotFoundException: WebView on windows unity editor supported?

Hi,

I am trying to use that on windows editor. I get
"DllNotFoundException: WebView
WebViewObject.Init (System.Action`1 cb, Boolean transparent, System.String ua) (at Assets/Plugins/WebViewObject.cs:141)
SampleWebView+c__Iterator0.MoveNext () (at Assets/Scripts/SampleWebView.cs:39)"

It would be great if I can test on windows unity editor, is this supported?

Any help is greatly appreciated.

Page could be loaded because of "net::ERR_CACHE_MISS"

I tried to load a live url as following code:

webviewObject = (new GameObject("WebViewObject")).AddComponent();
webviewObject.Init();

    webviewObject.SetMargins(5, 5, 5, Screen.height / 4);
    webviewObject.SetVisibility(true);
    webviewObject.LoadURL("http://www.unity3d.com");

but, I get error msg in my browser:

"The webpage at http://www.unity3d.com/ could not be loaded because:
net::ERR_CACHE_MISS

I also tried remove the following in the SampleScript:

  var src = System.IO.Path.Combine(Application.streamingAssetsPath, Url);
  var dst = System.IO.Path.Combine(Application.persistentDataPath, Url);
  var result = "";
  if (src.Contains("://")) {
    var www = new WWW(src);
    yield return www;
    result = www.text;
  } else {
    result = System.IO.File.ReadAllText(src);
  }
  System.IO.File.WriteAllText(dst, result);

and use webviewObject.LoadURL("http://www.unity3d.com"); that try to load the live directly.
I get the same error. But this work fine on iOS.

If I don't remove above code, everything work fine.

(Ps: Android version. 6.0)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.