如何使用自己的写的播放器 播放webview 中视频和音乐? 如何使用自己的写的播放器 播放webview 中视频和音乐? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 你直接看webview的代码,拼装下就行了,就是surface相关的,如果支持更多格式要自己写解码器了,可惜android 2.3又把opencore换了 是不是要把自己的播放器做成widget,就是装了多个播放器的时候,长按弹出选择播放时,有自己那个。这样是不是就可也把自己的播放器设置为默认播放器了? 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 { //下载 } } } WebView.setDownloadListener(new DownloadListener(){------------})实现onDownloadStart()的方法里写楼上的代码 C#和android两个程序中如何生成同一个随机数序列? Android有没有mac地址? 极品钢琴首页使用的技术?????? 如何根据包名获取应用的APK文件名 关于android蓝牙开发,求指点 android是什么 新浪微博分享的redirect_url应该怎么写? EditView字间距设定 eclipse 创建模拟器OK不能点 horizontalscrollview重写 利用intent实现activity与service之间的实时通信,可行否? Android 声控问题
这样是不是就可也把自己的播放器设置为默认播放器了?
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 {
//下载
}
}
}
实现onDownloadStart()的方法里写楼上的代码