Reputation: 3998
Is there a way to define shouldOverrideUrlLoading so that I can load URL in a specific external app.
I have a web app displayed in webview and I need to load some video files externally in some other video player instead of default android media player.
Here is the current code:
private class MainWebViewClient extends WebViewClient {
@Override
public boolean shouldOverrideUrlLoading(WebView webview, String url) {
Intent i = new Intent(Intent.ACTION_VIEW);
i.setDataAndType(Uri.parse(url), "video/mp4");
startActivity(i);
return true;
}
}
Thanks in advance.
Upvotes: 0
Views: 1207
Reputation: 65
WebView mWebView;
mWebView = (WebView) findViewById(R.id.webView1);
mWebView.setWebViewClient(new GeoWebViewClient());
mWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
mWebView.getSettings().setBuiltInZoomControls(true);
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.setWebChromeClient(new GeoWebChromeClient());
mWebView.loadUrl("http://.....");
public class GeoWebViewClient extends WebViewClient {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
}
pls check the following code once
Upvotes: 0
Reputation: 7024
You have to use onShowCustomView instead. Read more here under "HTML5 Video support".
Upvotes: 1