I have a WebView
with youtube video and 3 tabs. YouTube video is available in 1st Tab while in other 2 tabs there is a content.
Now i want to pause a video when user moves to other tabs. I have tried with
webView.onPause();
and
Class.forName("android.webkit.WebView")
.getMethod("onPause", (Class[]) null)
.invoke(webView, (Object[]) null);
but it is pausing whole WebView
and my other 2 tabs are also not responding. How to stop just a video instead of whole WebView
process
You can evaluate Javascript from android and stop video playing.
webView.evaluateJavascript(javascript, callBack); or older versions. webView.loadUrl(javascript); check this https://developer.android.com/reference/android/webkit/WebView.html#evaluateJavascript(java.lang.String,android.webkit.ValueCallback
What type video do you have? iframe or video tag?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With