如何使用自己的写的播放器 播放webview 中视频和音乐?

解决方案 »

  1.   

    你直接看webview的代码,拼装下就行了,就是surface相关的,如果支持更多格式要自己写解码器了,可惜android 2.3又把opencore换了
      

  2.   

    是不是要把自己的播放器做成widget,就是装了多个播放器的时候,长按弹出选择播放时,有自己那个。
    这样是不是就可也把自己的播放器设置为默认播放器了?
      

  3.   

    public void onDownloadStart(String url, String userAgent, String contentDisposition,
                        String mimetype, long contentLength) {
                    if (contentDisposition == null
                            || !contentDisposition.regionMatches(true, 0, "attachment", 0, 10)) {
                        Intent intent = new Intent(Intent.ACTION_VIEW);
                        Uri uri = Uri.parse(url);
                        intent.setDataAndType(uri, mimetype);
                        ResolveInfo info = getPackageManager().resolveActivity(intent,
                                PackageManager.MATCH_DEFAULT_ONLY);                    if (info != null) {
                            ComponentName myName = getComponentName();
                            if (!myName.getPackageName().equals(info.activityInfo.packageName)
                                    || !myName.getClassName().equals(info.activityInfo.name)) {
                                try {
                                     //此处链接自己写的播放器
                                    localPlayerIntent = getLocalPlayerInteng(uri);
                                    startActivity(localPlayerIntent);                                return;
                                } catch (ActivityNotFoundException ex) {
                                      
                                }
                            }
                        } else {
                             //下载
                        }
                    }
                }
      

  4.   

    WebView.setDownloadListener(new DownloadListener(){------------})
    实现onDownloadStart()的方法里写楼上的代码