Skip to content

Commit b9449ac

Browse files
committed
1 parent 3e1026d commit b9449ac

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

libTLabWebView/src/main/java/com/tlab/webkit/chromium/UnityConnect.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -565,8 +565,7 @@ public void Dispose() {
565565
abortCaptureThread();
566566

567567
mWebView.stopLoading();
568-
if (mVideoView != null)
569-
mWebView.removeView(mVideoView);
568+
if (mVideoView != null) mWebView.removeView(mVideoView);
570569
mWebView.destroy();
571570
mWebView = null;
572571
mView = null;
@@ -582,7 +581,11 @@ public void EvaluateJS(String js) {
582581
final Activity a = UnityPlayer.currentActivity;
583582
a.runOnUiThread(() -> {
584583
if (mWebView == null || !mWebView.getSettings().getJavaScriptEnabled()) return;
585-
mWebView.loadUrl("javascript:(function(){" + js + "})();");
584+
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) {
585+
mWebView.evaluateJavascript("(function(){" + js + "})();", null);
586+
} else {
587+
mWebView.loadUrl("javascript:(function(){" + js + "})();");
588+
}
586589
});
587590
}
588591

0 commit comments

Comments
 (0)