未发现错误但无法正常工作:
mWebView.setWebViewClient(new WebViewClient(){
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
if (url.endsWith(".mp4") || url.endsWith(".3gp") || url.endsWith(".m4v") || url.endsWith(".mov")) {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.parse(url), "video/*");
Log.d(TAG, "Play Media");
Uri tempPath = Uri.parse(url);
MediaPlayer player = MediaPlayer.create(RunHTML5WebView.this, tempPath);
player.start();
view.getContext().startActivity(intent);
startActivity(intent);
return true;
}
else{
return super.shouldOverrideUrlLoading(view, url);
}
}
});