sarbagyastha / youtube_player_flutter

A Flutter plugin for inline playback or streaming of YouTube videos using the official iFrame Player API.
https://youtube.sarbagyastha.com.np
BSD 3-Clause "New" or "Revised" License
692 stars 784 forks source link

[BUG] java.lang.NullPointerException: Attempt to invoke virtual method 'void android.webkit.WebView.evaluateJavascript(java.lang.String, android.webkit.ValueCallback)' on a null object reference #713

Open Happi3r opened 1 year ago

Happi3r commented 1 year ago

Describe the bug I don't know why I can't control the player after getting java.lang.NullPointerException.

Dependency Version youtube_player_iframe: ^3.0.4

Log:

E/flutter (20180): [ERROR:flutter/lib/ui/ui_dart_state.cc(198)] Unhandled Exception: PlatformException(NullPointerException, java.lang.NullPointerException: Attempt to invoke virtual method 'void android.webkit.WebView.evaluateJavascript(java.lang.String, android.webkit.ValueCallback)' on a null object reference, Cause: null, Stacktrace: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.webkit.WebView.evaluateJavascript(java.lang.String, android.webkit.ValueCallback)' on a null object reference
E/flutter (20180):  at io.flutter.plugins.webviewflutter.WebViewHostApiImpl.evaluateJavascript(WebViewHostApiImpl.java:426)
E/flutter (20180):  at io.flutter.plugins.webviewflutter.GeneratedAndroidWebView$WebViewHostApi$-CC.lambda$setup$13(GeneratedAndroidWebView.java:948)
E/flutter (20180):  at io.flutter.plugins.webviewflutter.GeneratedAndroidWebView$WebViewHostApi$$ExternalSyntheticLambda21.onMessage(Unknown Source:2)
E/flutter (20180):  at io.flutter.plugin.common.BasicMessageChannel$IncomingMessageHandler.onMessage(BasicMessageChannel.java:217)
zhuwei commented 1 year ago

this is webview_flutter's bug

AbdurRehman-coder commented 1 year ago

I also use the YouTube_player_ifram, and it creates clash with flutter_webview, anyone solved this problem