I have a webview, if the user clicks on a link, it opens in the same webview (I controll that with shouldOverrideUrlLoading()) but if it is a video link (mp4, 3gp) it does not launch the media player to reproduce the video (as it does in the normal browser app). How o force the media player to launch when a video link is clicked inside a webview?
Thanks!
In this case you will need to execute an Intent to load an external video url. This also conveniently allows user to return to the previous view ( activity ) without any problem. See code below....
/*-----------------------------------------------------------------------------------------------
* WebViewClientHandler() allows for overriding default phone web browser so we can load in gui
*----------------------------------------------------------------------------------------------*/
private class WebViewClientHandler extends WebViewClient {
public boolean shouldOverrideUrlLoading(WebView view, String url) {
Uri uri = Uri.parse("http://YOUTSTREAM.FLV");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
return true;
}
}
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