Giter Site home page Giter Site logo

defold / extension-webview Goto Github PK

View Code? Open in Web Editor NEW
12.0 16.0 9.0 458 KB

Defold extension for creating and controlling webviews to show html pages or evaluate javascript.

Home Page: https://defold.github.io/extension-webview/

License: MIT License

Java 34.92% C++ 42.20% Objective-C++ 22.87%
defold defold-game-engine defold-library extension-webview webview

extension-webview's Introduction

extension-webview's People

Contributors

agulev avatar andsveking avatar baochungit avatar britzl avatar dapetcu21 avatar jcash avatar thetrung avatar

Stargazers

 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

extension-webview's Issues

Game gets APP_CMD_LOST_FOCUS when showing webview on Android

OnePlus One on Android 6.0.1
WebView with Chrome/44.0.2403.119

The game gets APP_CMD_LOST_FOCUS right before Java_com_defold_webview_WebViewJNI_onPageFinished() gets called. The engine then freezes before Platform_Update() gets the chance to process the event from the queue and send it to Lua.

So you can show a web view, but you can't ever close it, since you can't process events coming from it or eval JS, since Lua is paused.

I added some dmLogs to showcase this:

12-24 23:18:02.789  4745  4766 I defold  : INFO:WEBVIEWEXTERNAL: update
12-24 23:18:02.805  4745  4766 I defold  : INFO:WEBVIEWEXTERNAL: update
12-24 23:18:02.823  4745  4766 I defold  : INFO:WEBVIEWEXTERNAL: update
12-24 23:18:02.834  4745  4745 V threaded_app: WindowFocusChanged: 0xb4d3e2a0 -- 0
12-24 23:18:02.834  4745  4764 V glfw-android: handleCommand: APP_CMD_LOST_FOCUS
12-24 23:18:02.877  4745  4745 W BindingManager: Cannot call determinedVisibility() - never saw a connection for the pid: 4745
12-24 23:18:04.914  4745  4745 I defold  : INFO:WEBVIEWEXTERNAL: onPageFinished

My guess is that Android wants to pause the game's activity that's in the background and invisible. I have no idea how to prevent this.

UPDATE: I've seen the same behaviour even when the webview doesn't occupy the whole screen.

Unfortunately, this is blocking us ๐Ÿ˜ž. The only workaround I found was engine.run_while_iconified = 1, but that is not a real solution, since it uses battery even when the app is in the background.

Building for iOS simulator yields linker warnings and errors

ld: warning: building for iOS Simulator, but linking in .tbd file (/opt/platformsdk/iPhoneSimulator14.0.sdk//usr/lib/system/libsystem_kernel.tbd) built for macOS
ld: warning: building for iOS Simulator, but linking in .tbd file (/opt/platformsdk/iPhoneSimulator14.0.sdk//usr/lib/system/libsystem_platform.tbd) built for macOS
ld: warning: building for iOS Simulator, but linking in .tbd file (/opt/platformsdk/iPhoneSimulator14.0.sdk//usr/lib/system/libsystem_pthread.tbd) built for macOS
Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_WKWebView", referenced from:
      objc-class-ref in libWebViewExternal_1.a(webview_darwin.mm_2.o)
  "_OBJC_CLASS_$_WKWebViewConfiguration", referenced from:
      objc-class-ref in libWebViewExternal_1.a(webview_darwin.mm_2.o)

The linker error I fixed by adding the WebKit framework to the extension manifest for x86_64-ios, but the warnings are still there. Not sure if they have any impact.

CALLBACK_RESULT_URL_OK not fired on Android

I tried this with both webview.open_raw() and webview.open() (with a data: URL) on the following devices:

One Plus One (A0001), Android 6 (not sure exactly what point version, as I don't have access to it now)
Alcatel Idol 4 6055P, Android 6.0.1

Eval callbacks like CALLBACK_RESULT_EVAL_OK fire correctly. It's just CALLBACK_RESULT_URL_OK that doesn't work.

New webviews don't open in long running app on Android

I've seen this but don't have more info / reproduction steps yet. Previous webviews do appear to be destroyed / if I spam create/open/destroy normally it works fine, but leaving app running for a long time and then trying to open doesn't seem to work. I'll test more and see if still happens.

Crash on Android with hidden = true

This happens when I call webview.open(webview_id, url, { hidden = true }) on my phone. hidden = false doesn't crash.

OnePlus One on Android 6.0.1
WebView with Chrome/44.0.2403.119

12-24 16:33:37.175   259   999 D audio_hw_primary: out_standby: enter: stream (0xb6076d40) usecase(1: low-latency-playback)
12-24 16:33:37.238   259   999 D hardware_info: hw_info_append_hw_type : device_name = speaker
12-24 16:33:38.658 18845 18877 V threaded_app: New input event: type=2
12-24 16:33:38.685 18845 18877 V threaded_app: New input event: type=2
12-24 16:33:38.713 18845 18845 I WebViewFactory: Loading com.android.webview version 44.0.2403.119 (code 246011900)
12-24 16:33:38.825 18845 18845 W System  : ClassLoader referenced unknown path: /system/app/webview/lib/arm
12-24 16:33:38.849 18845 18845 I LibraryLoader: Time to load native libraries: 19 ms (timestamps 9743-9762)
12-24 16:33:38.849 18845 18845 I LibraryLoader: Expected native library version number "",actual native library version number ""
12-24 16:33:38.907 18845 18845 V WebViewChromiumFactoryProvider: Binding Chromium to main looper Looper (main, tid 1) {2b0c78b}
12-24 16:33:38.907 18845 18845 I LibraryLoader: Expected native library version number "",actual native library version number ""
12-24 16:33:38.908 18845 18845 I chromium: [INFO:library_loader_hooks.cc(120)] Chromium logging enabled: level = 0, default verbosity = 0
12-24 16:33:38.931 18845 18845 I BrowserStartupController: Initializing chromium process, singleProcess=true
12-24 16:33:38.932 18845 18845 W art     : Attempt to remove non-JNI local reference, dumping thread
12-24 16:33:38.934 18845 18845 E SysUtils: ApplicationContext is null in ApplicationStatus
12-24 16:33:38.964 18845 18845 W chromium: [WARNING:resource_bundle.cc(285)] locale_file_path.empty()
12-24 16:33:38.969 18845 18845 E libEGL  : validate_display:255 error 3008 (EGL_BAD_DISPLAY)
12-24 16:33:38.969 18845 18845 E libEGL  : validate_display:255 error 3008 (EGL_BAD_DISPLAY)
12-24 16:33:39.080 18845 18845 E DataReductionProxySettingListener: No DRP key due to exception:java.lang.ClassNotFoundException: com.android.webview.chromium.Drp
12-24 16:33:39.082 18845 18952 W AudioManagerAndroid: Requires BLUETOOTH permission
12-24 16:33:39.133 18845 18845 W art     : Attempt to remove non-JNI local reference, dumping thread
12-24 16:33:39.152 18845 18845 W AwContents: onDetachedFromWindow called when already detached. Ignoring
12-24 16:33:39.157 18845 18845 W art     : Attempt to remove non-JNI local reference, dumping thread
12-24 16:33:39.157 18845 18845 W art     : Attempt to remove non-JNI local reference, dumping thread
12-24 16:33:39.161   247   247 E SELinux : avc:  denied  { find } for service=batterymanager scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:battery_service:s0 tclass=service_manager
12-24 16:33:39.204 18845 18950 W chromium: [WARNING:data_reduction_proxy_config.cc(423)] SPDY proxy OFF at startup
12-24 16:33:39.324 18845 18878 D defold  : DEBUG:SCRIPT: Error showing page:	nil
12-24 16:33:39.324 18845 18845 D AndroidRuntime: Shutting down VM
12-24 16:33:39.325 18845 18845 E AndroidRuntime: FATAL EXCEPTION: main
12-24 16:33:39.325 18845 18845 E AndroidRuntime: Process: org.rethinkplatform.rethink, PID: 18845
12-24 16:33:39.325 18845 18845 E AndroidRuntime: Theme: themes:{}
12-24 16:33:39.325 18845 18845 E AndroidRuntime: java.lang.IllegalArgumentException: View=android.widget.LinearLayout{b9e065f G.E...... ......I. 0,0-0,0} not attached to window manager
12-24 16:33:39.325 18845 18845 E AndroidRuntime: 	at android.view.WindowManagerGlobal.findViewLocked(WindowManagerGlobal.java:424)
12-24 16:33:39.325 18845 18845 E AndroidRuntime: 	at android.view.WindowManagerGlobal.removeView(WindowManagerGlobal.java:350)
12-24 16:33:39.325 18845 18845 E AndroidRuntime: 	at android.view.WindowManagerImpl.removeView(WindowManagerImpl.java:113)
12-24 16:33:39.325 18845 18845 E AndroidRuntime: 	at com.defold.webview.WebViewJNI$2.run(WebViewJNI.java:360)
12-24 16:33:39.325 18845 18845 E AndroidRuntime: 	at android.os.Handler.handleCallback(Handler.java:739)
12-24 16:33:39.325 18845 18845 E AndroidRuntime: 	at android.os.Handler.dispatchMessage(Handler.java:95)
12-24 16:33:39.325 18845 18845 E AndroidRuntime: 	at android.os.Looper.loop(Looper.java:148)
12-24 16:33:39.325 18845 18845 E AndroidRuntime: 	at android.app.ActivityThread.main(ActivityThread.java:5461)
12-24 16:33:39.325 18845 18845 E AndroidRuntime: 	at java.lang.reflect.Method.invoke(Native Method)
12-24 16:33:39.325 18845 18845 E AndroidRuntime: 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
12-24 16:33:39.325 18845 18845 E AndroidRuntime: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
12-24 16:33:39.329   748  2089 W ActivityManager:   Force finishing activity org.rethinkplatform.rethink/com.dynamo.android.DefoldActivity
12-24 16:33:39.390   748 10344 I OpenGLRenderer: Initialized EGL, version 1.4
12-24 16:33:39.479   748   758 I art     : Background partial concurrent mark sweep GC freed 6678(466KB) AllocSpace objects, 2(48KB) LOS objects, 33% free, 30MB/45MB, paused 1.623ms total 132.903ms

Web content with modals doesn't show on iOS

This includes <select type="date"> on iOS and even <select> on iPadOS. Tapping on a select does nothing (it should show a modal letting you to pick your value).

Currently trying to debug this, but I'm not really sure what might be causing it.

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.