0
我的應用程序使用WebView顯示網頁。我希望用戶能夠點擊視頻鏈接,並以橫向模式播放視頻。我現在在哪裏,視頻甚至不播放?WebView shouldOverrideUrlLoading Wont播放視頻
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.mnwv_main);
myWebView = (WebView) findViewById(R.id.webview);
myWebView.getSettings().setJavaScriptEnabled(true);
myWebView.getSettings().setPluginsEnabled(true);
myWebView.setWebViewClient(new WebViewClient());
myWebView.loadUrl("http://www.meanwhileinwv.com");
}
public boolean shouldOverrideUrlLoading (WebView view, String url) {
if (url.endsWith(".mp4")){
Intent in = new Intent (Intent.ACTION_VIEW , Uri.parse(url));
startActivity(in);
return true;
}
else
return false;
}
仍然給了我同樣的效果.. – comead