Android中的webview视频无法正常运行且没有错误

时间:2011-09-16 20:03:55

标签: android video webview

未发现错误但无法正常工作:

            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);
                    }
                }
            });

0 个答案:

没有答案